Some modifications and a new feature to application (app.js)