Start encoding the distance