Pre segment switch

These conditionals are really complex. At the least, there should be a comment describing the desired effect here. It feels like we're trying everything and seeing what works, however. I think this deserves a re-think.