refactored client class