Another small optimization to KD tree.