client refractored