refactored cursor