This should just be c === lastSegmentStart. Not quite sure how I ended up with something so convoluted.