It's getting late, and my brain is having trouble parsing whether this is really 100% equivalent in this function. I don't think it makes a difference in performance, and it's harder to figure out what's going on when the first segment of `nonEmptySegments` is possibly empty. Should we leave it as is?