Made closestContacts more general