Changes to the threading to make it actually work.