fixed bugin get_current_cell when called at the end of the line
refactored some of the hints code