cleanup for template