Refactoring of the diff API