Improved reduce command