Added new exceptions and exception handling code for more robust error handling.