Improved KDTree type definition