app.js improved