change map/reduce logic