modify map and reduce