refactoring cursor