Updated exception handling.