optimize node removal