Moving scripts to app.js

Also index is ready (needs final revision).