Testing closestDistance
Implemented closestDistance