More unit tests and error handling.