upstream app.js improvements