Attempt to condense Javascript

Remove JS from template files