add diff array function