How well does this work when you put this after line 678? If we put it here, the thread checks/stopping of old threads won't do anything if we drop the old threads for new ones before it.

Other than that, seems fine.