Add threading improvements