Extracted javascript from templates into a simple main.js file.