Fully implemented spinning of the event loop. (not tested)