This merge request is focused on adding utilties and refactoring for segment-related logic:
Update: removed the I/O segments utilities