Templates & Javascript

few bits of templates and JS cleaning..