Cleanup in the template