move client into own function