gotEvent function