finished extract in Segment.cpp/g