Implement basic map reduce functionality