changed logic in app.js