clean up template.php