fatorized the event function in c_event class