making progress on nearestneighbor - still has problems.