Gevent merge

This pull request should replace #155