improved efficiency of mcreduce by factoring out pair_fmap from a loop