implementing MapReduce function on a single machine