add function reduce