Tidied up the app.js a bit