Update to add sum function. There may be a cleaner way of doing this but...

... this appears to work. All unit tests pass, new unit tests added.