split main.lua, add support for nocanvas editing (buggy)