Sam raet 8

Refactor and clean up of raet segmentation support