Improve error reporting

Resolves #10