handle events in controller