clened up app.js code a bit