Improve sum() and fix the doc

* Used jfager's (Jason Fager) technique of updating `partials`.
* Moved the document-comments to the declaration of the method.