add thread functions