move RPC client creation into it's own function