Updated exception handling and API