Segment refactoring