More unit tests and Error Handling