add diff function