hooked everything in an event loop. Apologies to @bbangert :)