Some changes to threading