 
         device.controllerHandler = ControllerHandler()
 
-        var applicationHandler = ApplicationHandler(responder: root(device: device))
+        let applicationHandler = ApplicationHandler(responder: root(device: device))
 
-        let group = MultiThreadedEventLoopGroup(numberOfThreads: System.coreCount)
-        let bootstrap = ServerBootstrap(group: group)
+        group = MultiThreadedEventLoopGroup(numberOfThreads: System.coreCount)
+        bootstrap = ServerBootstrap(group: group)
             // Specify backlog and enable SO_REUSEADDR for the server itself
             .serverChannelOption(ChannelOptions.backlog, value: 256)
             .serverChannelOption(ChannelOptions.socket(SocketOptionLevel(SOL_SOCKET), SO_REUSEADDR), value: 1)

                channel.pipeline.configureHTTPServerPipeline(withErrorHandling: true).then {
                    // It's important we use the same handler for all accepted channels. The ControllerHandler is thread-safe!
                    channel.pipeline.add(handler: device.controllerHandler!).then {
                        channel.pipeline.add(handler: RequestHandler()).then {
                            channel.pipeline.add(handler: applicationHandler)
                        }
                    }
                }

        updateDiscoveryRecord()

        service.publish(options: NetService.Options(rawValue: 0))
    }

    public func wait() {
        try! channel.closeFuture.wait()
        try! channel6.closeFuture.wait()

        defer {
            try! group.syncShutdownGracefully()
        }
    }

    /// Publish the Accessory configuration on the Bonjour service
