add distance code