added thread client function