New distance_add algorithm in place, adjusted tests