Improvements to entity diffing code

Where will this be used?