Revised exception handling and comments.