cleanup of the template