segmentAtLength implemented, not tested