modified application.js function