Improve error handling, update tests, v0.2.1.