Ported to mapreduce api