Add exception handling.