Reworked event handling completely. Must test.