refactored script to javascript/application.js