Refactoring db.mapReduce into its own file.
Merging in mapreduce changes.