Added new Exception class to properly handle errors.