Add configureable timeout for cursor operations
Fix & some refactoring in tests