Apply cleanup to template plugin