Improve exception handling and update copyright notice.

add method comments.