generalized the sum function into a combine function.  thinking of either (a) adding a table.product() function or (b) getting rid of sum