modularizing js/engine.js
modularizing js/engine.js, removing old code