Added more tests of error messages.
Code cleanup