Refactor change detection

WIP
as usual, keep consistent use of `'` or `"`