rewriting Segment.cpp/h