Add further debugging; Proper event handling