add Reduce function