added removeInactiveNodes