cleanup of template