Added some error reporting mechanisms.