re-arrange app.js. somehow this also fixes #38