Refactored application.js