Changed reduce statements to be each