Huge cleanup for app.js