(this part of the code works well)