add diff Function