update for distances