Add option to raise Exception upon error, `encode` param to `encoding` param,

store scan only if it is valid, comment fixes, begin API documentation.

Tests not yet updated.
[ci skip]