cleanup for templates