Moved to application.js to avoid duplaicate event handlers