Modifications to KdTree to handle larger datasets