add multithreading for client