Added some additional exception throwing code.