modify to deal with deleted nodes in ways