Sped up Thread code