Cleanup JS in app.js

WIP to fix jslint warnings in the code.