restructured how events are being handled