added computeNearestNeighbor