Moved plain js from application.html to application.js for faster loading