Cursor refactor, tests