Update app.js

Some improvements.