Properly separate init and set_handler
Satisfy flake8
Use indefinite sleep for main loop.