     }
   }
 
-  func prepareChannel(address: String, host: String) {
+  func prepareService(address: String, host: String) {
     if (TLSButton.intValue == 0) {
-      channel = Channel(address:address)
+      service = EchoService(address:address)
     } else {
       let certificateURL = Bundle.main.url(forResource: "ssl", withExtension: "crt")!
       let certificates = try! String(contentsOf: certificateURL)
-      channel = Channel(address:address, certificates:certificates, host:host)
-    }
-    if let channel = channel {
-      channel.host = host
+      service = EchoService(address:address, certificates:certificates, host:host)
+    }
+    if let service = service {
+      service.channel.host = host
+      service.fileDescriptorSet = fileDescriptorSet
     }
   }
 

      // NONSTREAMING
      if let requestMessage = self.fileDescriptorSet.makeMessage("EchoRequest") {
        requestMessage.addField("text", value:self.messageField.stringValue)
        let requestMessageData = requestMessage.data()
        prepareChannel(address:address, host:host)
        guard let channel = channel else {
          return
        }
        call = channel.makeCall("/echo.Echo/Get")
        guard let call = call else {
          return
        }
        try call.perform(message: requestMessageData,
                         metadata: requestMetadata)
        {(callResult) in
          print("Client received status \(callResult.statusCode): \(callResult.statusMessage!)")
          if let messageData = callResult.resultData,
            let responseMessage = self.fileDescriptorSet.readMessage("EchoResponse",
                                                                     data:messageData) {
            try responseMessage.forOneField("text") {(field) in
              DispatchQueue.main.async {
                self.outputField.stringValue = field.string()
              }
            }
          } else {
            DispatchQueue.main.async {
              self.outputField.stringValue = "No message received. gRPC Status \(callResult.statusCode): \(callResult.statusMessage)"
            }
          }
        }

  @IBOutlet weak var TLSButton: NSButton!

  private var fileDescriptorSet : FileDescriptorSet

  private var service : EchoService?

  private var channel: Channel?
  private var updateCall: EchoUpdateCall?

  private var nowStreaming = false

  required init?(coder:NSCoder) {
