attempt to handle events and network in one thread
not so bad so far