moved most of app.js to index.js