Moving code over to event class