keep track of leg order
created distanceTolerance constant