Codefolding cleanup

Cleanup + updates required to work with CodeMirror 4.6.0 and Master