Add dodiff function