cleaning the templates