app.js refactor fix2