Docs2

Unit tests, error handling and reporting.