Added some exception behavior and a great deal of documentation.