Reworked app.js