Added some comments around the exception handling.