a-big-refactor

* use poll
* use timeout
* add requirements.txt