minor logic changes in application.js