Make global variables not use class variables as I think this was causing state leakage between threads.