Improve exception handling and update copyright notice.

Add method level comment.