Changed `mapReduce` method to use 2 or 3 input arguments instead of a single object