moved javascript code to application.js