added mapreduce for sorting