Almost done....needs comments for cursor function