added previous reduce.hpp changes that were unintentionally reverted