Improved error information.
Improved tests.