Upgrade app.js to best practises