strongly inspired by haxor created by Avinash Sajjanshetty (MIT licenced)
later this was rewritten to be fully asynchronous.