MaxDist now uses segment
maxDist is now with help of iterators