Moved range check to getNodeIndex method instead