refactor client using threads for polling user input while listening for incomming messages