Added funcitons to get a part of a segment and also clone it.
Added functions to create a copy of the segment and update its references. Added a function to clean any invalid reference.
Added functions to create a copy of the segment and update its references. Added a function to clean any invalid reference.