added diff algo