Reworking the distance metric