prepare for diff refactoring

Not much interesting here, see #1279 instead.