Tried to fix threading around event handling