moves js code to application.js