Updated exception handling and documentation to function correctly.