         self.checkForUpdatesButton.isEnabled = false
         self.checkForUpdatesButton.title     = "Checking..."
         
+        GeneralPreferencePane.hasLatestVersion(completion: { [weak self] latestVersion, latestVersionDownloadURL in
+            guard let _self = self else { return }
+            DispatchQueue.main.async {
+                
+                let alert: NSAlert = NSAlert()
+                alert.alertStyle = NSAlert.Style.informational
+                if let latestVersion = latestVersion, let latestVersionDownloadURL = latestVersionDownloadURL {
+                    alert.messageText     = "New version available!"
+                    alert.informativeText = "Do you want to download version \"\(latestVersion)\" now?"
+                    alert.addButton(withTitle: "Download")
+                    alert.addButton(withTitle: "Later")
+                    alert.beginSheetModal(for: _self.view.window!, completionHandler: { modalResponse in
+                        if modalResponse == .alertFirstButtonReturn {
+                            NSWorkspace.shared.open(latestVersionDownloadURL)
+                        }
+                    })
+                }else {
+                    alert.messageText     = "Installed version: \(GeneralPreferencePane.appVersion)"
+                    alert.informativeText = "Already on latest version"
+                    alert.addButton(withTitle: "Ok")
+                    alert.beginSheetModal(for: _self.view.window!, completionHandler: nil)
+                }
+                
+                self?.checkForUpdatesButton.isEnabled = true
+                self?.checkForUpdatesButton.title     = "Check for updates"
+                
+            }
+        })
+        
+    }
+}
+
+extension GeneralPreferencePane {
+    
+    class func hasLatestVersion(completion: @escaping (String?, URL?) -> Void) {
         let latestVersionURL: URL = URL(string: "http://pock.pigigaldi.com/api/latestRelease.json")!
-        
-        URLSession.shared.dataTask(with: latestVersionURL, completionHandler: { [weak self] data, response, error in
-            guard let _self = self else { return }
-            
-            defer {
-                DispatchQueue.main.async { [weak self] in
-                    self?.checkForUpdatesButton.isEnabled = true
-                    self?.checkForUpdatesButton.title     = "Check for updates"
-                }
+        URLSession.shared.dataTask(with: latestVersionURL, completionHandler: { data, response, error in
+            guard let json                = try? JSONSerialization.jsonObject(with: data!, options: []) as? [String: String],
+                  let latestVersionNumber = json?["version_number"], GeneralPreferencePane.appVersion < latestVersionNumber,
+                  let downloadLink        = json?["download_link"],
+                  let downloadURL         = URL(string: downloadLink) else {
+                    completion(nil, nil)
+                    return
             }
-            
-            if let json = try? JSONSerialization.jsonObject(with: data!, options: []) as? [String: String] {
-                if let latestVersionNumber = json?["version_number"] {
-                    DispatchQueue.main.async {
-                        let alert: NSAlert = NSAlert()
-                        alert.alertStyle = NSAlert.Style.informational
-                        if let downloadLink = json?["download_link"], let downloadURL = URL(string: downloadLink), _self.appVersion < latestVersionNumber {
-                            alert.messageText     = "New version available!"
-                            alert.informativeText = "Do you want to download version \"\(latestVersionNumber)\" now?"
-                            alert.addButton(withTitle: "Download")
-                            alert.addButton(withTitle: "Later")
-                            alert.beginSheetModal(for: _self.view.window!, completionHandler: { modalResponse in
-                                if modalResponse == .alertFirstButtonReturn {
-                                    NSWorkspace.shared.open(downloadURL)
-                                }
-                            })
-                        }else {
-                            alert.messageText     = "Installed version: \(_self.appVersion)"
-                            alert.informativeText = "Already on latest version"
-                            alert.addButton(withTitle: "Ok")
-                            alert.beginSheetModal(for: _self.view.window!, completionHandler: nil)
-                        }
-                    }
-                }
-            }
-            
+            completion(latestVersionNumber, downloadURL)
         }).resume()
     }
+    
 }

    @IBOutlet weak var checkForUpdatesButton:              NSButton!
    
    /// Core
    private var appVersion = Bundle.main.infoDictionary!["CFBundleShortVersionString"] as? String ?? "Unknown"
    
    /// Preferenceable
    let toolbarItemTitle: String   = "General"

    }
    
    private func loadVersionNumber() {
        self.versionLabel.stringValue = GeneralPreferencePane.appVersion
    }
    
    private func populatePopUpButton() {
