WIP: mid segment switch

A work-in-progress, don't merge.
I'll have a propose fix in the new upcoming branch.