removing a lot of the threading code