Implemented some event code.