re-organizing: clean-up in engine.js, creation of main.js