Generator refactor

Implemented all of the reducers using the nested generator pattern in map_reduce_utils

added a parameter to specify the precision of  results
see note above