refactoring client