Segment support & legacy migration

this should probably be private