client refactor