Add segment swap handling