Made changes to map-reduce query