actaully run the kd tree indexing and querying.