user defined event and when usage