My own implementation of the mapreduce algorithm