Event handler cleanup

Cleaned up event handling