refactored cursors, extensive tests (relates to #2)