Merged in cursorReworkingToAvoidNextTick branch