Compare end (instead of start) of the first range with start of the second range in rangeBefore.