refactor to use gevent.monkey