Refactored move_cursor method
Moved cursor line position logic to separate class