Added stopEvent function