Added diff function to Entity.java