Improve recursive event handling