Refactor change detection

WIP
I think `isPresent(record)` is not necessary, as you will hit a marker before you hit a null pointer.

Also this function will act very weird if called on tail maker (it will jump in next range). Maybe add a warning comment?