Documentation and tests for segmentation refactoring.