writing map reduce for fun and profit