reworking functions to run from cursorIndex