Cleaned up error messages and unit test.