completed mapreduce example