Added javadoc / better exceptions to cumsum