Changing map reduce to work with envelope bag