Periodic update of distances