moved js to template