Handle errors and shutdown much better. Added test with small examples.

Bumped version to 0.0.0.1.