refactored Client