Reworking template.js. Broke at the moment.