Refactored deleteNode() and put it into NodeSelector for better reuse. This should also fix #MC-193.