Added the function to recalculate the frame position and move it