more cleaning of templates