Do the distance calculations in closest() only once.