added listening thread for client