updated reducer to output to console