Move JS from template to the main application file