exception improvements.
unit tests.