Updated distances, sorted the list