Initial mapReduce implementation