Some changes to event handling