refactering client