documented sum function