Cleanup of template