minDistance() function added