Refactoring of Client.
More refactoring