accomplished cursor implementation after a lot of struggle
final implementation of next_cursor and previous_cursor