     
     func exitClick(sender: AnyObject?) {
         NSLog("exitClick")
+        
+        let alert = NSAlert()
+        
+        alert.addButton(withTitle: "Turn off")
+        alert.addButton(withTitle: "Cancel")
+        alert.messageText = "Turn off Blockstack?"
+        alert.informativeText = "You will not be able to access the decentralized internet if you turn off Blockstack."
+        alert.alertStyle = NSAlertStyle.warning
+        
+        if alert.runModal() == NSAlertFirstButtonReturn {
+            NSLog("User decided to exit...")
+            
+            NSStatusBar.system().removeStatusItem(statusItem)
+            
+            //            [self.blockstackProxyTask terminate];
+            //            NSLog(@"Blockstack Portal proxy terminated");
+            //
+            //            [self.corsProxyTask terminate];
+            //            NSLog(@"CORS proxy terminated");
+            //
+            //            [self stopBlockstackCoreApiAndExit];
+            
+            
+        }
     }
 }
 

    let corsProxyPort = 1337
    let coreProxyPort = 6270
    
    var statusItem : NSStatusItem = NSStatusItem()
    
    var isDevModeEnabled : Bool = false

            button.action = #selector(statusItemClick)
        }
        
    }

    func applicationWillTerminate(_ aNotification: Notification) {
        // Insert code here to tear down your application
    }

    func portalBaseUrl() -> String {
        return "http://localhost:\(portalPort())"
    }
    
    func portalPort() -> Int {
        return isDevModeEnabled ? developmentModePortalPort : productionModePortalPort
    }
    
    func openPortalClick(sender: AnyObject?) {
        NSLog("openPortalClick")
        openPortal(path: "/")
    }
    
    func openPortal(path: String?) {
        let portalURL = URL(string: "\(portalBaseUrl())\(path ?? "/")")
        NSLog("Opening portal with URL: \(portalURL)")
        NSWorkspace.shared().open(portalURL!)
    }
    
    func statusItemClick(sender: AnyObject?) {
