Do less DOM manipulation while updating the distance legend.