Polish and bugfixes for code editor, #1