Cleanup
Use a Cursor object to manage state