Adding tests a bit of refactoring, finishing up with cursor operations