Copied over updateThreads from previous attempt (it still works fine)