Moved cursor to separate function