more threading improvements