Added event and exception handlers