[distance] in single-to-multi and multi-to-multi we now check if the distance is zero and break the loops in this case;
[distance] polished code (proper naming for typedefs within classes);
now using for_each_segment instead of creating a container of segments;