Create event cancel function