reduce function done

finished reduce. need expand