Made threading changes