     private func argumentsCheckRemotePubKey(key: String) {
         var remotearg: String?
         guard self.config != nil else { return }
-        guard self.config!.offsiteServer.isEmpty == false else { return }
-        self.args = nil
+        guard (self.config?.offsiteServer.isEmpty ?? true) == false else { return }
         self.args = [String]()
-        if self.config!.sshport != nil {
+        if self.config?.sshport != nil {
             self.sshport()
         }
-        remotearg = self.config!.offsiteUsername + "@" + self.config!.offsiteServer
-        self.args!.append(remotearg!)
+        remotearg = (self.config?.offsiteUsername ?? "") + "@" + (self.config?.offsiteServer ?? "")
+        self.args?.append(remotearg!)
         if key == "rsa" {
-            self.args!.append("ls -al ~/" + self.remoteRsaPubkeyString)
+            self.args?.append("ls -al ~/" + self.remoteRsaPubkeyString)
         }
         if key == "dsa" {
-            self.args!.append("ls -al ~/" + self.remoteDsaPubkeyString)
+            self.args?.append("ls -al ~/" + self.remoteDsaPubkeyString)
         }
         self.command = "/usr/bin/ssh"
     }
 
     // Create local key with ssh-keygen
     private func argumentsCreateKeys(path: String, key: String) {
-        self.args = nil
         self.args = [String]()
         self.args!.append("-f")
         if key == "rsa" {
-            self.args!.append(path + "id_rsa")
+            self.args?.append(path + "id_rsa")
         } else {
-            self.args!.append(path + "id_dsa")
+            self.args?.append(path + "id_dsa")
         }
-        self.args!.append("-t")
-        self.args!.append(key)
-        self.args!.append("-N")
-        self.args!.append("")
+        self.args?.append("-t")
+        self.args?.append(key)
+        self.args?.append("-N")
+        self.args?.append("")
         self.command = "/usr/bin/ssh-keygen"
     }
 

    private func argumentsScpPubKey(path: String, key: String) {
        var remotearg: String?
        guard self.config != nil else { return }
        guard self.config!.offsiteServer.isEmpty == false else { return }
        self.args = nil
        self.args = [String]()
        if self.config!.sshport != nil {
            self.scpport()
        }
        self.args!.append(path)
        if key == "rsa" {
            remotearg = self.config!.offsiteUsername + "@" + self.config!.offsiteServer + ":" + self.remoteRsaPubkeyString
        } else {
            remotearg = self.config!.offsiteUsername + "@" + self.config!.offsiteServer + ":" + self.remoteDsaPubkeyString
        }
        self.args!.append(remotearg!)
        self.command = "/usr/bin/scp"
        self.commandCopyPasteTerminal = nil
        self.commandCopyPasteTerminal = self.command! + " " + self.args![0]
        for i in 1 ..< self.args!.count {
            self.commandCopyPasteTerminal = self.commandCopyPasteTerminal! + " " + self.args![i]
        }
    }

    private func argumentsCreateRemoteSshCatalog() {
        var remotearg: String?
        guard self.config != nil else { return }
        guard (self.config?.offsiteServer.isEmpty ?? true) == false else { return }
        self.args = [String]()
        if self.config?.sshport != nil {
            let sshport: String = "\"" + "-p " + String(self.config!.sshport!) + "\""
            self.args?.append(sshport)
        }
        remotearg = (self.config?.offsiteUsername ?? "") + "@" + (self.config?.offsiteServer ?? "")
        self.args?.append(remotearg!)
        self.args?.append("\"")
        self.args?.append("mkdir ~/.ssh")
        self.command = "/usr/bin/ssh"
        self.commandCopyPasteTerminal = self.command! + " " + self.args![0]
        for i in 1 ..< (self.args?.count ?? 0) {
            self.commandCopyPasteTerminal = self.commandCopyPasteTerminal! + " " + self.args![i]
        }
        self.commandCopyPasteTerminal = self.commandCopyPasteTerminal! + "\""
    }

    private func scpport() {
        self.args?.append("-P")
        self.args?.append(String(self.config?.sshport ?? 22))
    }

    private func sshport() {
        self.args?.append("-p")
        self.args?.append(String(self.config?.sshport ?? 22))
    }

    // Set the correct arguments
    func getArguments(operation: SshOperations, key: String?, path: String?) -> [String]? {
        switch operation {
        case .checkKey:
            self.argumentsCheckRemotePubKey(key: key ?? "")
        case .createKey:
            self.argumentsCreateKeys(path: path ?? "", key: key ?? "")
        case .scpKey:
            self.argumentsScpPubKey(path: path ?? "", key: key ?? "")
        case .createRemoteSshCatalog:
            self.argumentsCreateRemoteSshCatalog()
        case .chmod:
            self.argumentsChmod(key: key ?? "")
        }
        return self.args
    }

    func getCommand() -> String? {
        return self.command
    }

    init(hiddenID: Int?) {
        if let hiddenID = hiddenID {
            self.config = self.configurations!.getConfigurations()[self.configurations!.getIndex(hiddenID)]
        }
    }
}
