Also transformed into a threading.Thread subclass, rather than using a function + module-global state variables.