Improvements to entity diffing code

Note how we are using strings at various places for over a year and those never caused any problem, nor do I see any reason why they would.