fixup! Change algorithm to one with a worst case of (len/2 - 1). Add
full coverage of all branches.