Refactored client code to Client class