made cursor operations more general