register template cleanup