modified NearestPoints