Improve test suite
Cleanup error handling