more cleaning for templates