cleaning up template.php