client refactored