refactor Client