UPDATE ConnectThread function