cleans up templates