Add map reduce implementation