Tidied up app.js file