Better error handling. More tests.