refactored and threaded both client and server communication processes