finalize the 2nd version of map reduce