app.js improvements