Also, seems like another good candidate for arg simplification: lastSegmentStart could be ommitted if startingSpecial is always going to be lastSegmentSpecialsIndex (which given the name of this function seems like it should be the case).