Clean up the template