Fixes to code
Merge branch 'master' into cursorReworkingToAvoidNextTick