use map-reduce instead of writing own sum function