Re-factored JavaScript from index.html to separate app.js file.