added destructor for event cleanup and sample usage