merge from distance_rings branch. also added km.