improved step function for iteratorreducer.