Hooking into the event loop?