Working after removing much of the thread part of the code from client side