Template clean up