Improved app.js