Adding thread code HTree