Implement map-reduce operations