limit findNodeIndex calls and other optimizations