fix(ChangeDetector): fix issues with handling empty ranges

I think the way it is written now is easier to read.