diff --git a/enzevalos_iphone.xcodeproj/xcshareddata/xcschemes/enzevalos_iphone-AdHoc.xcscheme b/enzevalos_iphone.xcodeproj/xcshareddata/xcschemes/enzevalos_iphone-AdHoc.xcscheme
index 491b42af5d661577ebff4b3c04504eac8543f6a1..bb7ee46cb8dc1fccfa71eba6b5fa50e7bbfef3da 100644
--- a/enzevalos_iphone.xcodeproj/xcshareddata/xcschemes/enzevalos_iphone-AdHoc.xcscheme
+++ b/enzevalos_iphone.xcodeproj/xcshareddata/xcschemes/enzevalos_iphone-AdHoc.xcscheme
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
-   LastUpgradeVersion = "0940"
+   LastUpgradeVersion = "1010"
    version = "1.3">
    <BuildAction
       parallelizeBuildables = "YES"
diff --git a/enzevalos_iphone.xcodeproj/xcshareddata/xcschemes/enzevalos_iphone.xcscheme b/enzevalos_iphone.xcodeproj/xcshareddata/xcschemes/enzevalos_iphone.xcscheme
index da3d4d760a3a6b7c24c72094950ac48a0f6285f7..0976c58d9bd61995247832d1f92617f2a0b2b0be 100644
--- a/enzevalos_iphone.xcodeproj/xcshareddata/xcschemes/enzevalos_iphone.xcscheme
+++ b/enzevalos_iphone.xcodeproj/xcshareddata/xcschemes/enzevalos_iphone.xcscheme
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
-   LastUpgradeVersion = "0940"
+   LastUpgradeVersion = "1010"
    version = "1.7">
    <BuildAction
       parallelizeBuildables = "YES"
diff --git a/enzevalos_iphone/DataHandler.swift b/enzevalos_iphone/DataHandler.swift
index 8c37e4fe177233125ca7b9b17acfd1411df14c7a..616d2a93aba869a2cafbd98e816ba400c38ad66c 100644
--- a/enzevalos_iphone/DataHandler.swift
+++ b/enzevalos_iphone/DataHandler.swift
@@ -748,18 +748,6 @@ class DataHandler {
             mail.unableToDecrypt = false
             mail.received = received
 
-            var notStored = ""
-            for reference in references {
-                if let ref = findMail(msgID: reference) {
-                    // mail.addToReferenceMails(ref)
-                }
-                else {
-                    notStored = notStored + " ; " + (reference)
-                }
-            }
-            if notStored != "" {
-                //mail.notLoadedMessages = notStored
-            }
 
             if sender != nil {
                 handleFromAddress(sender!, fromMail: mail, autocrypt: autocrypt)
diff --git a/enzevalos_iphone/Logger.swift b/enzevalos_iphone/Logger.swift
index 0907f021c4a7855eb0401dadfb854b9231435b1e..aa4bf396d0fabbd2be5ae520c7a40b98ae7181c7 100644
--- a/enzevalos_iphone/Logger.swift
+++ b/enzevalos_iphone/Logger.swift
@@ -699,7 +699,7 @@ class Logger {
         event["communicationState"] = Logger.communicationState(subject: mail.subject ?? "")
         event["specialMail"] = Logger.specialMail(subject: mail.subject ?? "")
         event["timeInHeader"] = mail.date.description
-        event["bodyLength"] = (mail.body ?? "").count
+        event["bodyLength"] = (mail.body).count
         event["isEncrypted"] = mail.isEncrypted
         event["decryptedBodyLength"] = (mail.decryptedBody ?? "").count
         event["decryptedWithOldPrivateKey"] = mail.decryptedWithOldPrivateKey
@@ -728,7 +728,7 @@ class Logger {
         event["bcc"] = Logger.resolve(mailAddresses: mail.bcc ?? NSSet())
         event["communicationState"] = Logger.communicationState(subject: mail.subject ?? "")
         event["specialMail"] = Logger.specialMail(subject: mail.subject ?? "")
-        event["bodyLength"] = (mail.body ?? "").count
+        event["bodyLength"] = (mail.body).count
         //TODO:
         //event["signingKeyID"] = Logger.resolve(keyID: signingKeyID)
         //event["myKeyID"] = Logger.resolve(keyID: myKeyID)
diff --git a/enzevalos_iphone/MailHandler.swift b/enzevalos_iphone/MailHandler.swift
index 4680bf74dead1d7e1f04cfec62123afe167f855a..235057ce5e9b91f65b71506f9af4ebe01edef370 100644
--- a/enzevalos_iphone/MailHandler.swift
+++ b/enzevalos_iphone/MailHandler.swift
@@ -543,7 +543,7 @@ class MailHandler {
         }
         let useraddr = UserManager.loadUserValue(Attribute.userAddr) as! String
         let session = MCOSMTPSession()
-        session.hostname = UserManager.loadUserValue(Attribute.smtpHostname) as! String
+        session.hostname = UserManager.loadUserValue(Attribute.smtpHostname) as? String
         session.port = UInt32(UserManager.loadUserValue(Attribute.smtpPort) as! Int)
         session.username = useraddr
         if let type = UserManager.loadUserValue(.smtpAuthType) as? Int {
diff --git a/enzevalos_iphone/OAuth/EmailHelper.h b/enzevalos_iphone/OAuth/EmailHelper.h
index 1eb9d2aa39e3df114dd734e5595f35626158219e..9c1ec496c87e9122ac2c8020daf1c38cf013a715 100644
--- a/enzevalos_iphone/OAuth/EmailHelper.h
+++ b/enzevalos_iphone/OAuth/EmailHelper.h
@@ -25,12 +25,12 @@
 
 @interface EmailHelper : NSObject
 
-+ (EmailHelper *)singleton;
++ (EmailHelper *_Nonnull)singleton;
 
 @property(nonatomic, strong, nullable) id<OIDAuthorizationFlowSession> currentAuthorizationFlow;
 @property(nonatomic, nullable) GTMAppAuthFetcherAuthorization *authorization;
 
-- (void)doEmailLoginIfRequiredOnVC:(UIViewController*)vc completionBlock:(dispatch_block_t)completionBlock;
-- (void)checkIfAuthorizationIsValid:(void (^)(BOOL authorized))completionBlock;
+- (void)doEmailLoginIfRequiredOnVC:(UIViewController*_Nullable)vc completionBlock:(dispatch_block_t _Nullable )completionBlock;
+- (void)checkIfAuthorizationIsValid:(void (^_Nullable)(BOOL authorized))completionBlock;
 
 @end
diff --git a/enzevalos_iphone/QRScannerView.swift b/enzevalos_iphone/QRScannerView.swift
index 684106d89e7db99d7b0bfb5ac87d86c520313bbd..fe63b76ad8e0071b6b2de48a77be13ef59c3b23f 100644
--- a/enzevalos_iphone/QRScannerView.swift
+++ b/enzevalos_iphone/QRScannerView.swift
@@ -134,7 +134,7 @@ class QRScannerView: ViewControllerPannable, AVCaptureMetadataOutputObjectsDeleg
     func metadataOutput(_ captureOutput: AVCaptureMetadataOutput, didOutput metadataObjects: [AVMetadataObject], from connection: AVCaptureConnection) {
 
         // Check if the metadataObjects array is not nil and it contains at least one object.
-        if metadataObjects == nil || metadataObjects.count == 0 {
+        if metadataObjects.count == 0 {
             qrCodeFrameView?.path = nil
             bottomLabel.text = NSLocalizedString("scanQRCode", comment: "")
             return
diff --git a/enzevalos_iphone/ReadViewController.swift b/enzevalos_iphone/ReadViewController.swift
index af9c2eb14dbb389bafbd60e189ac073de6f6001c..de16670dead8229e48fe2096f1be9b3a162ad90e 100644
--- a/enzevalos_iphone/ReadViewController.swift
+++ b/enzevalos_iphone/ReadViewController.swift
@@ -532,7 +532,7 @@ class ReadViewController: UITableViewController {
                     }
                 }
                 body.append("\n" + NSLocalizedString("subject", comment: "describing what subject was choosen") + ": " + (mail.subject ?? ""))
-                body.append("\n------------------------\n\n" + (mail.decryptedBody ?? mail.body ?? ""))
+                body.append("\n------------------------\n\n" + (mail.decryptedBody ?? mail.body))
                 body = body.components(separatedBy: "\n").map { line in
                     if line.hasPrefix(">") {
                         return ">" + line
diff --git a/enzevalos_iphone/SendViewController+Invitation.swift b/enzevalos_iphone/SendViewController+Invitation.swift
index 2c25b16ee780ac483cf42e93ee39024154cbdd55..c0cd81b1d7fb0978b679542b8885cb1eeae4b405 100644
--- a/enzevalos_iphone/SendViewController+Invitation.swift
+++ b/enzevalos_iphone/SendViewController+Invitation.swift
@@ -170,7 +170,7 @@ extension SendViewController {
         guard self.invitationSelection.selectedWords.isEmpty == false && self.isEligibleForInvitation() == true else {
             let attributedString = NSMutableAttributedString(string: self.textView.text)
             let fullRange = NSRange(location: 0, length: attributedString.string.count)
-            attributedString.addAttributes([NSAttributedStringKey.font: self.textView.font], range: fullRange)
+            attributedString.addAttributes([NSAttributedStringKey.font: self.textView.font as Any], range: fullRange)
             attributedString.removeAttribute(NSAttributedStringKey.backgroundColor, range: fullRange)
             self.textView.attributedText = attributedString
             return
@@ -317,7 +317,7 @@ extension SendViewController {
                 }
 
                 return nil
-            }).flatMap { $0 }
+            }).compactMap { $0 }
 
         self.invitationSelection.selectedWords = Set<NSRange>(selectedWords)
     }
diff --git a/enzevalos_iphone/SendViewController.swift b/enzevalos_iphone/SendViewController.swift
index 3003aa8f794db5886119470a75886f4ed5c46d03..280dccd904cdfac492d4ce59698fcff9346d22f5 100644
--- a/enzevalos_iphone/SendViewController.swift
+++ b/enzevalos_iphone/SendViewController.swift
@@ -176,7 +176,7 @@ class SendViewController: UIViewController {
             }
 
             subjectText.setText(prefilledMail.subject ?? "")
-            textView.text.append(prefilledMail.body ?? "")
+            textView.text.append(prefilledMail.body)
         }
 
         let sepConst: CGFloat = 1 / UIScreen.main.scale