Building KD Tree for Processing