ported 0.4.x diff function to 0.5.x

The more mature version of the  diff function is finally brought to 0.5.x.