more simple logic in getUnvisitedNode()