move client into its own file