Finally managed to get distance_add right (slightly faster than before, but
scales a lot better)