Finished Refactoring Code. Ported over client to a Thread
Refactored code