Function transfered to application.js