added thread tree functions