Template cleaning up