diff --git a/enzevalos_iphone.xcodeproj/project.pbxproj b/enzevalos_iphone.xcodeproj/project.pbxproj
index f41fbac3aaede35e8a3da8eadb0a700108e34589..ebc1ff7b525273155f121245322855562b370a79 100644
--- a/enzevalos_iphone.xcodeproj/project.pbxproj
+++ b/enzevalos_iphone.xcodeproj/project.pbxproj
@@ -131,6 +131,7 @@
 		47F867E22052B48E00AA832F /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 47F867E12052B48E00AA832F /* libz.tbd */; };
 		47F867E42052B49800AA832F /* libbz2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 47F867E32052B49800AA832F /* libbz2.tbd */; };
 		50F2E7D66366C779705987A7 /* Pods_enzevalos_iphoneUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF67EF30BB065CC9C0D17940 /* Pods_enzevalos_iphoneUITests.framework */; };
+		71DFE5BA240679E80042019C /* HeaderExtractionValues.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71DFE5B9240679E80042019C /* HeaderExtractionValues.swift */; };
 		7500EE9D4F3130671F5C1AE2 /* Pods_enzevalos_iphoneTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7977EA7012D8E98D186D5C60 /* Pods_enzevalos_iphoneTests.framework */; };
 		8428A8531F4369C0007649A5 /* Gamification.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8428A8521F4369C0007649A5 /* Gamification.storyboard */; };
 		8428A8551F4369CF007649A5 /* GamificationElements.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8428A8541F4369CF007649A5 /* GamificationElements.xcassets */; };
@@ -397,6 +398,7 @@
 		48C250BB32BF11B683003BA1 /* Pods-enzevalos_iphone-enzevalos_iphoneUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-enzevalos_iphone-enzevalos_iphoneUITests.debug.xcconfig"; path = "../enzevalos_iphone_workspace/Pods/Target Support Files/Pods-enzevalos_iphone-enzevalos_iphoneUITests/Pods-enzevalos_iphone-enzevalos_iphoneUITests.debug.xcconfig"; sourceTree = "<group>"; };
 		66E758F271CD65AB3E5FE7A7 /* Pods-enzevalos_iphoneUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-enzevalos_iphoneUITests.debug.xcconfig"; path = "../enzevalos_iphone_workspace/Pods/Target Support Files/Pods-enzevalos_iphoneUITests/Pods-enzevalos_iphoneUITests.debug.xcconfig"; sourceTree = "<group>"; };
 		6EBCCD02AD3B95D8317810E2 /* Pods-enzevalos_iphoneTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-enzevalos_iphoneTests.debug.xcconfig"; path = "../enzevalos_iphone_workspace/Pods/Target Support Files/Pods-enzevalos_iphoneTests/Pods-enzevalos_iphoneTests.debug.xcconfig"; sourceTree = "<group>"; };
+		71DFE5B9240679E80042019C /* HeaderExtractionValues.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeaderExtractionValues.swift; sourceTree = "<group>"; };
 		796D16D79BED5D60B580E602 /* Pods-enzevalos_iphoneUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-enzevalos_iphoneUITests.release.xcconfig"; path = "../enzevalos_iphone_workspace/Pods/Target Support Files/Pods-enzevalos_iphoneUITests/Pods-enzevalos_iphoneUITests.release.xcconfig"; sourceTree = "<group>"; };
 		7977EA7012D8E98D186D5C60 /* Pods_enzevalos_iphoneTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_enzevalos_iphoneTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		8428A8521F4369C0007649A5 /* Gamification.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Gamification.storyboard; sourceTree = "<group>"; };
@@ -701,6 +703,7 @@
 				477548DD21F5DABE000B22A8 /* MailServerConnectionError.swift */,
 				47CEAC97222541B40075B7DC /* MailSession.swift */,
 				478AF714222FD5C600AEF69E /* IncomingMail.swift */,
+				71DFE5B9240679E80042019C /* HeaderExtractionValues.swift */,
 			);
 			name = mail;
 			sourceTree = "<group>";
@@ -1645,6 +1648,7 @@
 				F12060821DA552FC00F6EF37 /* MailHandlerDelegator.swift in Sources */,
 				474994022261E4E6000F8DA5 /* SimpleSendIcon.swift in Sources */,
 				A12F91D821F3A99800AB0589 /* NSLayoutConstraintExtension.swift in Sources */,
+				71DFE5BA240679E80042019C /* HeaderExtractionValues.swift in Sources */,
 				A18E7D771FBDE5D9002F7CC9 /* LoggingEventType.swift in Sources */,
 				F1984D741E1E92B300804E1E /* LabelStyleKit.swift in Sources */,
 				A1FA44A721E10E1400DB02AC /* TravelHandler.swift in Sources */,
@@ -1867,7 +1871,7 @@
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 9.3;
+				IPHONEOS_DEPLOYMENT_TARGET = 13.0;
 				MTL_ENABLE_DEBUG_INFO = YES;
 				ONLY_ACTIVE_ARCH = YES;
 				SDKROOT = iphoneos;
@@ -1921,7 +1925,7 @@
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 9.3;
+				IPHONEOS_DEPLOYMENT_TARGET = 13.0;
 				MTL_ENABLE_DEBUG_INFO = NO;
 				SDKROOT = iphoneos;
 				SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
@@ -1950,7 +1954,7 @@
 				);
 				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
 				INFOPLIST_FILE = "enzevalos_iphone/PLists/enzevalos-Info.plist";
-				IPHONEOS_DEPLOYMENT_TARGET = 9.3;
+				IPHONEOS_DEPLOYMENT_TARGET = 13.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
 				LIBRARY_SEARCH_PATHS = (
 					"$(inherited)",
@@ -2008,7 +2012,7 @@
 				);
 				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
 				INFOPLIST_FILE = "enzevalos_iphone/PLists/enzevalos-Info.plist";
-				IPHONEOS_DEPLOYMENT_TARGET = 9.3;
+				IPHONEOS_DEPLOYMENT_TARGET = 13.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
 				LIBRARY_SEARCH_PATHS = (
 					"$(inherited)",
diff --git a/enzevalos_iphone/AppDelegate.swift b/enzevalos_iphone/AppDelegate.swift
index f7f5e42f1b2b446aac2c888e4e7511fe6c082d76..fa2e3ec793f82c7f9a1ea87fb2b03366e67fcc2d 100644
--- a/enzevalos_iphone/AppDelegate.swift
+++ b/enzevalos_iphone/AppDelegate.swift
@@ -39,7 +39,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
     
     func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
         // Override point for customization after application launch.
-        //UINavigationBar.appearance().backgroundColor = UIColor.blueColor()
         if UIScreen.main.bounds.height < 700 {
             kDefaultImageViewSize = 20
             kDefaultTitleFontSize = 33
@@ -97,7 +96,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
     func application(_ application: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
         if url.absoluteURL.absoluteString.hasPrefix("com.googleusercontent.apps.459157836079-csn0a9p3r8p7q6216fn5u7a6vcum80gn") {
             if let currentAuthorizationFlow = EmailHelper.singleton().currentAuthorizationFlow {
-                if currentAuthorizationFlow.resumeAuthorizationFlow(with: url) {
+                if currentAuthorizationFlow.resumeExternalUserAgentFlow(with: url) {
                     EmailHelper.singleton().currentAuthorizationFlow = nil
                     return true
                 }
diff --git a/enzevalos_iphone/EnzevalosContact+CoreDataClass.swift b/enzevalos_iphone/EnzevalosContact+CoreDataClass.swift
index 5187b1f2071c8290a8b70d646eebce95bbffd479..d1408ebc3442853f002e1e866715feefd385e93d 100644
--- a/enzevalos_iphone/EnzevalosContact+CoreDataClass.swift
+++ b/enzevalos_iphone/EnzevalosContact+CoreDataClass.swift
@@ -36,7 +36,11 @@ fileprivate func < <T : Comparable>(lhs: T?, rhs: T?) -> Bool {
     }
 }
 
-
+/**
+ EnzevalosContact is used for persons and items of the address book (by apple).
+ One enzevalosContact maps to one person/item of the address book.
+ One enzevalosContact links to multiple key records since the person have multiple keys.
+ */
 @objc(EnzevalosContact)
 open class EnzevalosContact: NSManagedObject, Contact, Comparable {
 
@@ -57,6 +61,9 @@ open class EnzevalosContact: NSManagedObject, Contact, Comparable {
         }
     }
 
+    /**
+     Just like nameOptional or a localized variant of "no name". Just in case you like to enforce a name.
+     */
     open var name: String {
         if let name = nameOptional {
             return name
@@ -146,6 +153,9 @@ open class EnzevalosContact: NSManagedObject, Contact, Comparable {
         }
     }
 
+    /**
+     A set of associated public keys
+     */
     var publicKeys: Set<PersistentKey> {
         get {
             var pks = Set<PersistentKey>()
@@ -155,7 +165,9 @@ open class EnzevalosContact: NSManagedObject, Contact, Comparable {
             return pks
         }
     }
-
+    /**
+    A set of associated key records
+    */
     open var records: [KeyRecord] {
         get {
             if let krecords = self.keyrecords as? Set<KeyRecord> {
@@ -195,6 +207,9 @@ open class EnzevalosContact: NSManagedObject, Contact, Comparable {
         return date
     }
 
+    /**
+     Related item in the address book (from apple)
+     */
     open var cnContact: CNContact? {
         get {
             if let cn = cnidentifier {
@@ -207,6 +222,9 @@ open class EnzevalosContact: NSManagedObject, Contact, Comparable {
         }
     }
 
+    /**
+     Create a new cnContact in the address book.
+     */
     open var newCnContact: CNContact {
         let con = CNMutableContact()
         let name = self.displayname
@@ -241,13 +259,6 @@ open class EnzevalosContact: NSManagedObject, Contact, Comparable {
         return nil
     }
 
-    func getAddressByMCOAddress(_ mcoaddress: MCOAddress) -> Mail_Address? {
-        if (mcoaddress.mailbox) != nil {
-            return getAddress(mcoaddress.mailbox.lowercased())
-        }
-        return nil
-    }
-
     open func getMailAddresses() -> [MailAddress] {
         var adr = [MailAddress] ()
         for a in addresses {
@@ -257,6 +268,9 @@ open class EnzevalosContact: NSManagedObject, Contact, Comparable {
         return adr
     }
 
+    /**
+     Is the address associated to the person(enzevalos contact)
+     */
     func isAddress(mailadr: String) -> Bool {
         for adr in getMailAddresses() {
             if mailadr.lowercased() == adr.mailAddress.lowercased() {
diff --git a/enzevalos_iphone/EnzevalosContact+CoreDataProperties.swift b/enzevalos_iphone/EnzevalosContact+CoreDataProperties.swift
index 72caa20cd1e68f7def11dd219b308623a97a35be..106d86af4e10628f76d4affb25e04ff493498c2b 100644
--- a/enzevalos_iphone/EnzevalosContact+CoreDataProperties.swift
+++ b/enzevalos_iphone/EnzevalosContact+CoreDataProperties.swift
@@ -29,6 +29,9 @@ extension EnzevalosContact {
     }
 
     @NSManaged public var displayname: String?
+    /**
+     Identifier to look up contact in the address book
+     */
     @NSManaged public var cnidentifier: String?
     @NSManaged public var color: UIColor?
     @NSManaged public var addresses: NSSet
diff --git a/enzevalos_iphone/ExportInfoViewController.swift b/enzevalos_iphone/ExportInfoViewController.swift
index 3d9cc4bd01a083b97d4dadc3e03ce69ac60f1736..6afc513158b4e3671b2d00cfe1eedd0a58b97d89 100644
--- a/enzevalos_iphone/ExportInfoViewController.swift
+++ b/enzevalos_iphone/ExportInfoViewController.swift
@@ -25,7 +25,7 @@ class ExportInfoViewController: UITableViewController {
     var calledFromTravel = false
 
     @IBAction func websiteButtonTouch(_ sender: Any) {
-        UIApplication.shared.openURL(URL(string: "https://" + url)!)
+        UIApplication.shared.open(URL(string: "https://" + url)!, options: [:], completionHandler: nil)
     }
 
     @IBAction func nextButtonTouch(_ sender: Any) {
diff --git a/enzevalos_iphone/Folder+CoreDataClass.swift b/enzevalos_iphone/Folder+CoreDataClass.swift
index 3a6ea446a3d411bc20c6482fda099d804c3957e1..68b5157fa38b1dd6a7dec566b8eb5401251188a1 100644
--- a/enzevalos_iphone/Folder+CoreDataClass.swift
+++ b/enzevalos_iphone/Folder+CoreDataClass.swift
@@ -41,6 +41,9 @@ public class Folder: NSManagedObject {
         }
     }
 
+    /**
+     Please read the RFC.
+     */
     var uids: MCOIndexSet {
 
         get {
diff --git a/enzevalos_iphone/Folder+CoreDataProperties.swift b/enzevalos_iphone/Folder+CoreDataProperties.swift
index a1f45577d6d09965f49de8b8b165a177a8ead9b8..8918988235fea555f3eea0b3ff92c8fecd3d2ceb 100644
--- a/enzevalos_iphone/Folder+CoreDataProperties.swift
+++ b/enzevalos_iphone/Folder+CoreDataProperties.swift
@@ -22,9 +22,15 @@ extension Folder {
     @NSManaged public var keyRecords: NSSet?
     @NSManaged public var path: String //backendFolderPath
     @NSManaged public var lastUpdate: Date?
+    /**
+     Used for logging.
+     */
     @NSManaged public var pseudonym: String
     @NSManaged public var icon: String?
 
+    /**
+     Please read the RFC!
+     */
     public var uidvalidity: UInt32? {
         set {
             if let num = newValue {
diff --git a/enzevalos_iphone/HeaderExtractionValues.swift b/enzevalos_iphone/HeaderExtractionValues.swift
new file mode 100644
index 0000000000000000000000000000000000000000..224f4be5b3cf1a3ee9c2af20c113b5a04d61bf3f
--- /dev/null
+++ b/enzevalos_iphone/HeaderExtractionValues.swift
@@ -0,0 +1,19 @@
+//
+//  HeaderExtractionValues.swift
+//  enzevalos_iphone
+//
+//  Created by Katharina Müller on 26.02.20.
+//  Copyright © 2020 fu-berlin. All rights reserved.
+//
+
+import Foundation
+enum HeaderExtractionValues: String {
+    case MIMEVersion = "MIME-Version"
+    case Received = "Received"
+    case ContentType = "Content-Type"
+    case ContentTransferEncoding = "Content-Transfer-Encoding"
+    case ContentDisposition = "Content-Disposition" //i.e. used by smime
+    case DKIMSignature = "DKIM-Siagnature"//DomainKeys for e-mail authentication
+    case InReplyTo = "In-Reply-To"
+    case XMailer = "X-Mailer" //Information about the mail server
+}
diff --git a/enzevalos_iphone/InboxViewController.swift b/enzevalos_iphone/InboxViewController.swift
index 42b4d199d56ea57ec8a83b9b88383d5c5b671539..1637bc58ffc54ef9584ee4a35dfc884fdd3eb5ed 100644
--- a/enzevalos_iphone/InboxViewController.swift
+++ b/enzevalos_iphone/InboxViewController.swift
@@ -30,7 +30,7 @@ class InboxViewController: UITableViewController, InboxCellDelegator {
     var loading = false {
         didSet {
             if loading {
-                let activityIndicator = UIActivityIndicatorView(style: .gray)
+                let activityIndicator = UIActivityIndicatorView(style: UIActivityIndicatorView.Style.medium)
                 activityIndicator.frame = CGRect(x: 0, y: 0, width: 200, height: 44)
                 activityIndicator.startAnimating()
                 tableView.tableFooterView = activityIndicator
@@ -70,7 +70,7 @@ class InboxViewController: UITableViewController, InboxCellDelegator {
         lastUpdateButton.customView = lastUpdateLabel
 
         searchController.searchResultsUpdater = self
-        searchController.dimsBackgroundDuringPresentation = false
+        searchController.obscuresBackgroundDuringPresentation = false
         searchController.searchBar.scopeButtonTitles = [NSLocalizedString("Sender", comment: ""), NSLocalizedString("Subject", comment: ""), NSLocalizedString("Body", comment: ""), NSLocalizedString("All", comment: "")]
         searchController.searchBar.delegate = self
         if #available(iOS 11.0, *) {
diff --git a/enzevalos_iphone/IntroInfoButton.swift b/enzevalos_iphone/IntroInfoButton.swift
index 462d1e10deece22c56cb4920e6cf61047e448e5d..25c6fa9a4adf896bb2218d55c76158305ba5d2d3 100644
--- a/enzevalos_iphone/IntroInfoButton.swift
+++ b/enzevalos_iphone/IntroInfoButton.swift
@@ -54,8 +54,7 @@ extension IntroInfoButton where Self: UIViewController {
         let alert = UIAlertController(title: titleText, message: titleDescription, preferredStyle: .alert)
         if let url = url {
             alert.addAction(UIAlertAction(title: NSLocalizedString("MoreInformation", comment: "More Information label"), style: .default, handler: { (action: UIAlertAction!) -> Void in
-                UIApplication.shared.openURL(URL(string: url)!)
-                //MoreInformationViewController.pushInfoView(navigationController: self.navigationController, state: .Secure)
+                UIApplication.shared.open(URL(string: url)!, options: [:], completionHandler: nil)
             }))
         }
         alert.addAction(UIAlertAction(title: "OK", style: .cancel, handler: { (action: UIAlertAction!) -> Void in
diff --git a/enzevalos_iphone/KeyRecord+CoreDataClass.swift b/enzevalos_iphone/KeyRecord+CoreDataClass.swift
index 5b99b081804fab177ab65f35a23b013f4dce02ab..e95102f4f17d96163dc8fd9a18343d3c820e6e49 100644
--- a/enzevalos_iphone/KeyRecord+CoreDataClass.swift
+++ b/enzevalos_iphone/KeyRecord+CoreDataClass.swift
@@ -23,12 +23,17 @@ import CoreData
 import Contacts
 import UIKit
 
+/**
+ Key records are mostly used in the inbox and for id (views). For each key we have a single key record. There are also key records for each mail address without keys, for instance when receiving unsigned mails.
+ 
+ One person can have multiple key records, e.g. one with key, one without a key or multiple keys.
+ */
 @objc(KeyRecord)
 public class KeyRecord: NSManagedObject, Record {
 
     public var isUser: Bool {
         get{
-            /*
+            /**
              A keyrecord matches to the user if:
                 * we know the secret key, because we are the key owner
                 * the mail addresses matches
@@ -45,6 +50,9 @@ public class KeyRecord: NSManagedObject, Record {
         }
     }
 
+    /**
+     Does the key record has a secret key?
+     */
     public var isSecretKey: Bool {
         if let id = self.keyID {
             return DataHandler.handler.findSecretKey(keyID: id) != nil
@@ -86,6 +94,11 @@ public class KeyRecord: NSManagedObject, Record {
         return nil
     }
     
+    
+    /**
+     MyNick is unique where as multiple key records can have the same name.
+     It is used to display different key records.
+     */
     public var myNick: String {
         if let n = self.nick {
             return n
@@ -109,6 +122,10 @@ public class KeyRecord: NSManagedObject, Record {
         return id
     }
     
+    /**
+     One person can have multiple key records, e.g. one with key, one without a key or multiple keys.
+     In case of multiple keys we have a primaryID. The key of this id is used for decryption etc.
+     */
     public var isPrimaryID: Bool {
         if let keyID = self.keyID {
             for addr in self.addresses {
@@ -129,6 +146,9 @@ public class KeyRecord: NSManagedObject, Record {
         }
     }
 
+    /**
+     It is the current fingerprint of the public key.
+     */
     public var fingerprint: String? {
         get {
             if let k = pgpKey {
@@ -154,12 +174,19 @@ public class KeyRecord: NSManagedObject, Record {
         }
     }
 
+    /**
+     EnzevalosContact provides some contact information about the key record.
+     */
     public var ezContact: EnzevalosContact {
         get {
             return contact
         }
     }
 
+    
+    /**
+     Is a list of all received mails from this record.
+     */
     public var mails: [PersistentMail] {
         get {
             if let m = persistentMails as? Set<PersistentMail> {
@@ -168,7 +195,10 @@ public class KeyRecord: NSManagedObject, Record {
             return []
         }
     }
-
+    
+    /**
+     cnContact is the original corresponding contact in the address book.
+     */
     public var cnContact: CNContact? {
         get {
             return contact.cnContact
@@ -195,6 +225,9 @@ public class KeyRecord: NSManagedObject, Record {
         }
     }
 
+    /**
+     Corresponding mail addresses to the current key.
+     */
     public var addresses: [MailAddress] {
         get {
             if let k = activeKey {
diff --git a/enzevalos_iphone/ListViewController.swift b/enzevalos_iphone/ListViewController.swift
index e733f1e26e2e91bf805f4b66ce5aa7a359d57f68..ccbb957b0063c4184b8347640ad7941e57f0a16e 100644
--- a/enzevalos_iphone/ListViewController.swift
+++ b/enzevalos_iphone/ListViewController.swift
@@ -76,7 +76,7 @@ class ListViewController: UITableViewController {
     override func viewDidLoad() {
         super.viewDidLoad()
         searchController.searchResultsUpdater = self
-        searchController.dimsBackgroundDuringPresentation = false
+        searchController.obscuresBackgroundDuringPresentation = false
         definesPresentationContext = true
         if #available(iOS 11.0, *) {
             navigationItem.searchController = searchController
diff --git a/enzevalos_iphone/MailServerConnectionError.swift b/enzevalos_iphone/MailServerConnectionError.swift
index a6100b92b91b7e30d3dab993216fa235873af382..d726c974c960fc6cb35cd9944ddaac2e18bc173b 100644
--- a/enzevalos_iphone/MailServerConnectionError.swift
+++ b/enzevalos_iphone/MailServerConnectionError.swift
@@ -9,11 +9,15 @@
 import Foundation
 
 enum UserRecommandation: Int {
-    case CheckPWAddr = 1,
+    case
+    CheckConnectionInfo = 0,
+    CheckPWAddr = 1,
     CheckIMAPServerConfig = 2,
     CheckSMTPServerConfig = 3,
     CheckSSLConfiguration = 4,
-    CheckOAUTH = 5
+    CheckOAUTH = 5,
+    
+    Default = 100
 }
 
 // see: https://github.com/MailCore/mailcore2/blob/31e308a36108301e2f9cc5c4489bb81ff84e6d3a/src/objc/abstract/MCOConstants.h
@@ -21,58 +25,59 @@ enum MailServerConnectionError: Error {
     case NoError, ConnectionError, TLSNotAvailableError, ProtocolParseError, CertificateError, AuthenticationError,
     GmailIMAPNotEnabledError, GmailExceededBandwidthLimitError, GmailTooManySimultaneousConnectionsError, MobileMeMovedError,
     YahooUnavailableError, ImapIdleError, IdentityError, StartTLSNotAvailableError, AuthenticationRequiredError,
-    SMTPInvalidAccountError, ServerDateError, UnspecifiedError, StorageLimitSMTPError, NoInternetconnection, NoData, SecurityIndicatorError
+    SMTPInvalidAccountError, ServerDateError, UnspecifiedError, StorageLimitSMTPError, NoInternetconnection, NoData, SecurityIndicatorError,
+    ImapSetupError, SmtpSetupError
     
-    var userRecommandations: [UserRecommandation] {
+    var userRecommandations: UserRecommandation {
         get {
-            var recommandations = [UserRecommandation] ()
             switch self {
             case .NoError:
-                return recommandations
+                return .Default
             case .AuthenticationError:
-                recommandations.append(.CheckPWAddr)
-                return recommandations
+                return .CheckPWAddr
             case .ConnectionError, .NoData:
-                recommandations.append(.CheckIMAPServerConfig)
-                recommandations.append(.CheckSMTPServerConfig)
-                recommandations.append(.CheckSSLConfiguration)
-                recommandations.append(.CheckPWAddr)
-                return recommandations
+                return .CheckConnectionInfo
             case .TLSNotAvailableError, .CertificateError, .StartTLSNotAvailableError:
-                recommandations.append(.CheckSSLConfiguration)
-                return recommandations
-        case .ProtocolParseError, .ImapIdleError, .GmailTooManySimultaneousConnectionsError, .GmailExceededBandwidthLimitError, .IdentityError, .ServerDateError, .NoInternetconnection:
-                return recommandations
+                return .CheckSSLConfiguration
+            case .ProtocolParseError, .ImapIdleError, .GmailTooManySimultaneousConnectionsError, .GmailExceededBandwidthLimitError, .IdentityError, .ServerDateError, .NoInternetconnection:
+                return .Default
             case .GmailIMAPNotEnabledError, .YahooUnavailableError:
-                recommandations.append(.CheckOAUTH)
-                return recommandations
+                return .CheckOAUTH
             case .AuthenticationRequiredError, .SMTPInvalidAccountError:
-                recommandations.append(.CheckPWAddr)
-                return recommandations
+                return .CheckPWAddr
             case .UnspecifiedError, .MobileMeMovedError, .StorageLimitSMTPError:
-                return recommandations
-            case .SecurityIndicatorError:
-                return recommandations
+                return .Default
+            case .SecurityIndicatorError :
+                return .Default
+            case .ImapSetupError :
+                return .CheckIMAPServerConfig
+            case .SmtpSetupError :
+                return .CheckSMTPServerConfig
+            default :
+                return .Default
             }
         }
     }
     
     var localizedUIBodyString: String {
         get{
-            let recom = self.userRecommandations
-            if recom.count == 1 && recom.contains(UserRecommandation.CheckPWAddr) {
+            let recom : UserRecommandation = self.userRecommandations
+            switch recom {
+            case UserRecommandation.CheckPWAddr :
                 return "MailServerError.Authentication.Body"
-            }
-            else if recom.count == 1 && recom.contains(UserRecommandation.CheckOAUTH) {
+            case UserRecommandation.CheckOAUTH :
                 return "MailServerError.OAUTH.Body"
-            }
-            else if recom.count == 1 && recom.contains(UserRecommandation.CheckSSLConfiguration) {
+            case UserRecommandation.CheckSSLConfiguration :
                 return "MailServerError.Crypto.Body"
-            }
-            else if recom.contains(.CheckIMAPServerConfig) {
+            case UserRecommandation.CheckIMAPServerConfig :
+                return "MailServerError.IMAP.Body"
+            case UserRecommandation.CheckSMTPServerConfig :
+                return "MailServerError.SMTP.Body"
+            case UserRecommandation.CheckConnectionInfo :
                 return "MailServerError.Connection.Body"
+            default:
+                return "MailServerError.Default.Body"
             }
-            return "MailServerError.Default.Body"
         }
     }
     
diff --git a/enzevalos_iphone/MailSession.swift b/enzevalos_iphone/MailSession.swift
index 2c180d480246269564256c720668ab24b2d68a6c..1df6ce70ad5ba706546da5a92236fc7f2e42f9c3 100644
--- a/enzevalos_iphone/MailSession.swift
+++ b/enzevalos_iphone/MailSession.swift
@@ -333,7 +333,7 @@ class MailServer: Comparable {
                         }
                         else if self.toTestConnType.isEmpty && !self.sendCallback {
                             self.sendCallback = true
-                            self.callback(MailServerConnectionError.ConnectionError, self)
+                            self.callback(MailServerConnectionError.ImapSetupError, self)
                         }
                         return
                     }
@@ -363,11 +363,11 @@ class MailServer: Comparable {
                 if let error = error {
                     let serverError = MailServerConnectionError.findErrorCode(error: error)
                     if self.sendCallback(session: session, error: serverError) {
-                        self.callback(serverError, self)
+                        self.callback(MailServerConnectionError.SmtpSetupError, self)
                     }
                     else {
                         if !self.findSMTPHost() {
-                            self.callback(serverError, self)
+                            self.callback(MailServerConnectionError.SmtpSetupError, self)
                         }
                     }
                 }
diff --git a/enzevalos_iphone/Mail_Address+CoreDataClass.swift b/enzevalos_iphone/Mail_Address+CoreDataClass.swift
index c7eb9a9b672de92199d398b9f6537c94352ee4dc..17d570ce529664a7efaf0378616525bf1c436ade 100644
--- a/enzevalos_iphone/Mail_Address+CoreDataClass.swift
+++ b/enzevalos_iphone/Mail_Address+CoreDataClass.swift
@@ -25,7 +25,9 @@ import Contacts
 
 @objc(Mail_Address)
 open class Mail_Address: NSManagedObject, MailAddress {
-
+    /**
+    What key should be used to send encrypted messages or to verify messages?
+    */
     public var primaryKey: PersistentKey? {
         get {
             if hasKey {
@@ -44,6 +46,9 @@ open class Mail_Address: NSManagedObject, MailAddress {
         return address.lowercased()
     }
 
+    /**
+     In the address book a mail address has a label (e.g. work, private, ...).
+     */
     open var label: CNLabeledValue<NSString> {
         if let cnc = self.contact?.cnContact {
             for adr in cnc.emailAddresses {
@@ -62,6 +67,9 @@ open class Mail_Address: NSManagedObject, MailAddress {
         return false
     }
     
+    /**
+     Is this a mail address of the user?
+     */
     public var isUser: Bool {
         get {
             if let userAddr = UserManager.loadUserValue(Attribute.userAddr) as? String {
@@ -71,6 +79,9 @@ open class Mail_Address: NSManagedObject, MailAddress {
         }
     }
     
+    /**
+     Just create a MCOAddress. Mailcore (our IMAP/SMTP library) needs MCOAddresses to send mails etc.
+     */
     public func transform () -> MCOAddress {
         var name = address
         if let contact = contact {
diff --git a/enzevalos_iphone/Mail_Address+CoreDataProperties.swift b/enzevalos_iphone/Mail_Address+CoreDataProperties.swift
index fe549dcf07846e97bfda06877461d51e1790015a..b627b37f487042acca2ec7b305bc4572287cee6e 100644
--- a/enzevalos_iphone/Mail_Address+CoreDataProperties.swift
+++ b/enzevalos_iphone/Mail_Address+CoreDataProperties.swift
@@ -34,9 +34,18 @@ extension Mail_Address {
     @NSManaged public var cc: NSSet?
     @NSManaged public var from: NSSet?
     @NSManaged public var to: NSSet?
+    /**
+     Just for logging.
+     */
     @NSManaged public var pseudonym: String
-    @NSManaged public var primaryKeyID: String? //TODO: set to private?
+    /**
+     What key should be used to send encrypted messages or to verify messages?
+     */
+    @NSManaged public var primaryKeyID: String?
     @NSManaged private var keys: NSSet?
+    /**
+     Did we invited the mail address owner to use encryption?
+     */
     @NSManaged public var invitations: Int16
 
     var primaryActiveKeyID: String? {
diff --git a/enzevalos_iphone/OAuth/EmailHelper.h b/enzevalos_iphone/OAuth/EmailHelper.h
index 9c1ec496c87e9122ac2c8020daf1c38cf013a715..da180b030e85e3acc50503f04fab19a773b2438d 100644
--- a/enzevalos_iphone/OAuth/EmailHelper.h
+++ b/enzevalos_iphone/OAuth/EmailHelper.h
@@ -27,7 +27,7 @@
 
 + (EmailHelper *_Nonnull)singleton;
 
-@property(nonatomic, strong, nullable) id<OIDAuthorizationFlowSession> currentAuthorizationFlow;
+@property(nonatomic, strong, nullable) id<OIDExternalUserAgentSession> currentAuthorizationFlow;
 @property(nonatomic, nullable) GTMAppAuthFetcherAuthorization *authorization;
 
 - (void)doEmailLoginIfRequiredOnVC:(UIViewController*_Nullable)vc completionBlock:(dispatch_block_t _Nullable )completionBlock;
diff --git a/enzevalos_iphone/Onboarding.swift b/enzevalos_iphone/Onboarding.swift
index fbb1282b476b8e6f3232b5178cdb773e4dd510b9..09ae1c25c2f2aca1a6e8341adc1c353cf2e7c942 100644
--- a/enzevalos_iphone/Onboarding.swift
+++ b/enzevalos_iphone/Onboarding.swift
@@ -595,7 +595,7 @@ class Onboarding: NSObject {
         AppDelegate.getAppDelegate().requestForAccess(callback)
     }
 
-    static func checkIMAPConfigUI() {
+    static func checkIMAPOrSmtpConfigUI() {
         if testConfig {
             AppDelegate.getAppDelegate().window?.rootViewController = Onboarding.checkConfigView()
             return
@@ -609,6 +609,9 @@ class Onboarding: NSObject {
         if Onboarding.credentialFails >= 3 {
             Onboarding.manualSet = true
             var error = MailServerConnectionError.AuthenticationError
+            if let smtp = previousSMTP, let e = MailServerConnectionError.findPrioError(errors: smtp.errors) {
+                error = e
+            }
             if let imap = previousIMAP, let e = MailServerConnectionError.findPrioError(errors: imap.errors) {
                 error = e
             }
@@ -685,7 +688,7 @@ class Onboarding: NSObject {
                 }
             }
         }
-        checkIMAPConfigUI()
+        checkIMAPOrSmtpConfigUI()
     }
     
     static func googleLogin() {
@@ -758,7 +761,7 @@ class Onboarding: NSObject {
             }
         }
         currentIMAP = mailSession
-        checkIMAPConfigUI()
+        checkIMAPOrSmtpConfigUI()
     }
     
     static private func setSMTPSession() -> MailSession{
@@ -804,7 +807,7 @@ class Onboarding: NSObject {
             }
         }
         currentSMTP = mailSession
-        checkIMAPConfigUI()
+        checkIMAPOrSmtpConfigUI()
     }
     
     static func imapCompletion(imapWorks: Bool) {
@@ -819,13 +822,13 @@ class Onboarding: NSObject {
             let duration = start.timeIntervalSinceNow
             if duration < TimeInterval(-10) {
                 Onboarding.credentialFails = 3
-                checkIMAPConfigUI()
+                checkIMAPOrSmtpConfigUI()
                 return
             }
         }
         Onboarding.credentialFails += 1
         print("IMAP failed")
-        checkIMAPConfigUI()
+        checkIMAPOrSmtpConfigUI()
     }
 
     static func smtpCompletion(smtpWorks: Bool) {
@@ -838,7 +841,7 @@ class Onboarding: NSObject {
         print("SMTP failed!")
         // IMAP works but not SMTP -> show detail config
         Onboarding.credentialFails = 3
-        checkIMAPConfigUI()
+        checkIMAPOrSmtpConfigUI()
     }
 
    
diff --git a/enzevalos_iphone/OutgoingMail.swift b/enzevalos_iphone/OutgoingMail.swift
index 723ecc5854ce920dfe8d8aee17b844e1697462f6..797b0405079748539729f290c501a50d441b889f 100644
--- a/enzevalos_iphone/OutgoingMail.swift
+++ b/enzevalos_iphone/OutgoingMail.swift
@@ -329,6 +329,7 @@ class OutgoingMail {
         builder.header.bcc = bccEntrys
         builder.header.from = sender
         builder.header.subject = subject
+       // builder.header.setExtraHeaderValue("1.0", forName: "MIME-Version")
         builder.header.setExtraHeaderValue("letterbox", forName: "X-Mailer")
         if autocrypt {
             Autocrypt.addAutocryptHeader(builder)
diff --git a/enzevalos_iphone/PersistentKey+CoreDataClass.swift b/enzevalos_iphone/PersistentKey+CoreDataClass.swift
index 39181f2eb03b31fe7b8cd882badbadb5b1b43a40..d908198e6c8c7b0b6923b2600754b745f1ec2459 100644
--- a/enzevalos_iphone/PersistentKey+CoreDataClass.swift
+++ b/enzevalos_iphone/PersistentKey+CoreDataClass.swift
@@ -9,6 +9,13 @@
 import Foundation
 import CoreData
 
+/**
+ Is a stored public key.
+ 
+ It stores the keydata, some additional information and relations to key records etc.
+ 
+ A key can be part of a key chain, such that one key introduced another key (yet not implemented)
+ */
 @objc(PersistentKey)
 public class PersistentKey: NSManagedObject {
 
@@ -44,6 +51,9 @@ public class PersistentKey: NSManagedObject {
         return self.verifiedDate != nil
     }
 
+    /**
+     Is the key expired (according to the crypto scheme)?
+     */
     func isExpired() -> Bool {
         let pgp = SwiftPGP()
         if let key = pgp.loadKey(id: self.keyID) {
diff --git a/enzevalos_iphone/PersistentKey+CoreDataProperties.swift b/enzevalos_iphone/PersistentKey+CoreDataProperties.swift
index b1af66d58d263e57cef06b558bad1be68d334d68..74919be9eea96c1aaf3a93f08785f9c1d0fc814d 100644
--- a/enzevalos_iphone/PersistentKey+CoreDataProperties.swift
+++ b/enzevalos_iphone/PersistentKey+CoreDataProperties.swift
@@ -18,22 +18,62 @@ extension PersistentKey {
 
     @NSManaged public var keyID: String
     @NSManaged public var verifiedDate: Date?
+    /**
+     When did we received the last signed mail?
+     */
     @NSManaged public var lastSeen: Date?
+    /**
+        When did we received the last mail with autocrypt header?
+    */
     @NSManaged public var lastSeenAutocrypt: Date?
+    /**
+     When did we imported the key?
+     */
     @NSManaged public var discoveryDate: Date?
     @NSManaged private var mailaddress: NSSet?
+    /**
+     What is the mail which contains this key (only the first)?
+     */
     @NSManaged public var firstMail: PersistentMail?
+    /**
+     A pseudonym was used for logging.
+     */
     @NSManaged public var pseudonym: String
+    /**
+     Did we send our own public key to the owner of this public key?
+     This means does the owner knows our public key?
+     */
     @NSManaged public var sentOwnPublicKey: Bool
     @NSManaged public var signedMails: NSSet?
     @NSManaged private var record: KeyRecord?
     @NSManaged private var activeKey: PersistentKey?
+    /**
+     This is only for the travler scenario. You can ignore it.
+     */
     @NSManaged public var activeRepeal: PersistentMail?
+    /**
+     Currently not used.
+     */
     @NSManaged private var parentKey: PersistentKey?
+    /**
+     Currently not used.
+     */
     @NSManaged private var childKeys: NSSet?
+    /**
+    This is only for the travler scenario. You can ignore it.
+    */
     @NSManaged public var repealedByMails: NSSet?
+    /**
+    This is only for the travler scenario. You can ignore it.
+    */
     @NSManaged private var isRepealed: Bool
+    /**
+    This is only for the travler scenario. You can ignore it.
+    */
     @NSManaged private var gotFailedCallForUse: Bool
+    /**
+    This is only for the travler scenario. You can ignore it.
+    */
     @NSManaged private var isMisstrusted: Bool
     
     var mailaddresses: NSSet? {
@@ -64,6 +104,9 @@ extension PersistentKey {
         return parentKey != nil
     }
     
+    /**
+     Currently not used.
+     */
     var rootKey: PersistentKey {
         get {
             var key = self
@@ -100,7 +143,9 @@ extension PersistentKey {
         keys.append(rootKey)
         return keys
     }
-    
+    /**
+    This is only for the travler scenario. You can ignore it.
+    */
     public var repealed: Bool {
         get {
             return rootKey.isRepealed
@@ -109,7 +154,9 @@ extension PersistentKey {
             rootKey.isRepealed = newRepealState
         }
     }
-    
+    /**
+    This is only for the travler scenario. You can ignore it.
+    */
     public var failedCallForUse: Bool {
         get {
             return rootKey.gotFailedCallForUse
@@ -118,7 +165,9 @@ extension PersistentKey {
             rootKey.gotFailedCallForUse = newState
         }
     }
-    
+    /**
+    This is only for the travler scenario. You can ignore it.
+    */
     public var misstrust: Bool {
         get {
             return rootKey.isMisstrusted
@@ -127,7 +176,9 @@ extension PersistentKey {
             rootKey.isMisstrusted = trust
         }
     }
-    
+    /**
+     This is the autocrypt prefer enc state.
+     */
     public var prefer_encryption: EncState{
         set {
             let name = "preferEncryption"
diff --git a/enzevalos_iphone/PersistentMail +CoreDataClass.swift b/enzevalos_iphone/PersistentMail +CoreDataClass.swift
index e1ce1fe37b895448c5be58219c83468cb495d4ec..4764e26c74881b6e6ed2560994dbc24d8c5716c1 100644
--- a/enzevalos_iphone/PersistentMail +CoreDataClass.swift	
+++ b/enzevalos_iphone/PersistentMail +CoreDataClass.swift	
@@ -21,7 +21,16 @@
 
 import Foundation
 import CoreData
-
+/**
+A PersistentMail stores all information about one mail:
+ - Sender, receivers
+ - subject, date
+ - body
+ - encryption state
+ - signature state
+ - attached files, keys
+ 
+*/
 @objc(PersistentMail)
 open class PersistentMail: NSManagedObject, Mail {
     public var predecessor: PersistentMail? = nil
@@ -66,6 +75,9 @@ open class PersistentMail: NSManagedObject, Mail {
         }
     }
     
+    /**
+     This the signed first mail of the signed key?
+     */
     var isNewPubKey: Bool {
         guard let signedKey = self.signedKey else {
             return false
@@ -77,6 +89,9 @@ open class PersistentMail: NSManagedObject, Mail {
         return false
     }
 
+    /**
+     Just a flag if the user read this mail.
+     */
     var isRead: Bool {
         get {
             let value = flag.contains(MCOMessageFlag.seen)
@@ -92,6 +107,9 @@ open class PersistentMail: NSManagedObject, Mail {
         }
     }
 
+    /**
+     Just a flag if the user answered the mail.
+     */
     var isAnwered: Bool {
         get {
             let value = flag.contains(MCOMessageFlag.answered)
@@ -132,6 +150,10 @@ open class PersistentMail: NSManagedObject, Mail {
         return returnString
     }
 
+    /**
+     Just a short part of the body. Can be used for a preview.
+     In case of trouble there is no preview.
+     */
     var shortBodyString: String? {
         guard !trouble else {
             return nil
diff --git a/enzevalos_iphone/PersistentMail +CoreDataProperties.swift b/enzevalos_iphone/PersistentMail +CoreDataProperties.swift
index 56d99c588d31fbd4617d7a75ff01f3b878683fcd..e032c064af288dbb73d4f397fabe1a365f2f8056 100644
--- a/enzevalos_iphone/PersistentMail +CoreDataProperties.swift	
+++ b/enzevalos_iphone/PersistentMail +CoreDataProperties.swift	
@@ -21,7 +21,6 @@
 import Foundation
 import CoreData
 
-
 extension PersistentMail {
 
     @nonobjc open override class func fetchRequest() -> NSFetchRequest<NSFetchRequestResult> {
@@ -29,11 +28,20 @@ extension PersistentMail {
     }
 
     @NSManaged public var body: String?
+    /**
+     Deprecated
+     */
     @NSManaged public var visibleBody: String?
     @NSManaged public var decryptedBody: String?
     @NSManaged public var encryptedBody: String?
     @NSManaged public var date: Date
+    /**
+     secret key which is attacted to the mail (to import)
+     */
     @NSManaged public var secretKey: String?
+    /**
+     The corresponding key record
+     */
     @NSManaged public var record: KeyRecord?
     
     public var hasAttachment: Bool {
@@ -45,6 +53,9 @@ extension PersistentMail {
         }
     }
 
+    /**
+     Some mail flags, e.g. read flag, answered flag (according to RFC)
+     */
     public var flag: MCOMessageFlag {
         set {
             if newValue != flag {
@@ -68,28 +79,86 @@ extension PersistentMail {
         }
 
     }
+    /**
+     Please use encryption state
+     */
     @NSManaged public var isEncrypted: Bool
+    /**
+     This mail is signed but check isSigned, too.
+     We recommand to use signature state
+     */
     @NSManaged public var isSigned: Bool
+    /**
+     We could verify the signature (with a given public key)
+     */
     @NSManaged public var isCorrectlySigned: Bool
+    /**
+     This mail is encrypted but we could not decrypt the message (e.g. the secret key is missing)
+     */
     @NSManaged public var unableToDecrypt: Bool
+    /**
+     Subject of a mail (according to RFC)
+     */
     @NSManaged public var subject: String?
+    /**
+     Which folder is used to store the mail?
+     */
     @NSManaged public var folder: Folder
+    /**
+     Not used.
+     */
     @NSManaged public var firstKey: PersistentKey?
+    /**
+     What key is the signature key of this mail?
+     */
     @NSManaged public var signedKey: PersistentKey?
+    /**
+     Did we received the mail?
+     */
     @NSManaged public var received: Bool
+    /**
+     Only used in traveler scenario.
+     */
     @NSManaged public var deleteWhileTravel: Bool
+    /**
+    Only used in traveler scenario.
+    */
     @NSManaged public var storeEncrypted: Bool
+    /**
+    Only used in traveler scenario.
+    */
     @NSManaged public var repealsKey: PersistentKey?
     
+    /**
+     This can be used for threading. This is defined in a RFC.
+     */
     @NSManaged public var gmailMessageID: NSNumber?
+    /**
+    This can be used for threading. This is defined in a RFC.
+    */
     @NSManaged public var gmailThreadID: NSNumber?
+    /**
+    Please read up this mail in the RFC!
+    */
     @NSManaged public var messageID: String?
+    /**
+     Currently not used.
+     */
     @NSManaged public var notLoadedMessages: String?
+    /**
+     Only for traveler scenario.
+     */
     @NSManaged public var decryptedKey: PersistentKey?
 
+    /**
+     Sender mail client.
+     */
     @NSManaged public var xMailer: String?
 
-
+    /**
+     Key id of the signature key.
+     TODO rename to signedKeyID
+     */
     public var keyID: String? {
         set {
             self.willChangeValue(forKey: "keyID")
@@ -116,6 +185,9 @@ extension PersistentMail {
     }
 
 
+    /**
+     Does this mail has some (crypto) errors, e.g. manipulated encryption or signature?
+     */
     public var trouble: Bool {
         set {
             self.willChangeValue(forKey: "trouble")
@@ -130,6 +202,9 @@ extension PersistentMail {
         }
 
     }
+    /**
+     Please read the RFC!
+     */
     public var uid: UInt64 {
         set {
             self.willChangeValue(forKey: "uid")
@@ -146,6 +221,9 @@ extension PersistentMail {
             return 0
         }
     }
+    /**
+     Please read the RFC!
+     */
     public var uidvalidity: UInt32? {
         set {
             if let num = newValue {
@@ -215,6 +293,9 @@ extension PersistentMail {
 
     }
 
+    /**
+     Enter a password and if possible import the secret keys.
+     */
     public func processSecretKey(pw: String?) throws -> Bool {
         var sk = ""
         if let key = secretKey {
@@ -232,6 +313,9 @@ extension PersistentMail {
     @NSManaged public var cc: NSSet?
     @NSManaged public var to: NSSet
     @NSManaged public var attachments: NSSet?
+    /**
+     Can be used for threading. Please read the RFC.
+     */
     @NSManaged public var referenceMails: NSSet?
 
 }
diff --git a/enzevalos_iphone/QRScannerView.swift b/enzevalos_iphone/QRScannerView.swift
index b80c34553cddfca8c31643a32ec667b108cdb762..a25d312c9e9b410c7410c893e20893348d1fe7ad 100644
--- a/enzevalos_iphone/QRScannerView.swift
+++ b/enzevalos_iphone/QRScannerView.swift
@@ -178,7 +178,7 @@ class QRScannerView: ViewControllerPannable, AVCaptureMetadataOutputObjectsDeleg
                             let alert = UIAlertController(title: NSLocalizedString("fingerprintMissmatchShort", comment: "Found fingerprint does not match"), message: NSLocalizedString("fingerprintMissmatchText", comment: "Found fingerprint does not match"), preferredStyle: .alert)
                             alert.addAction(UIAlertAction(title: NSLocalizedString("MoreInformation", comment: "More Information"), style: .default, handler: {
                                     (action: UIAlertAction!) -> Void in
-                                    UIApplication.shared.openURL(URL(string: "https://userpage.fu-berlin.de/letterbox/faq.html#headingWrongFingerprint")!)
+                                UIApplication.shared.open(URL(string: "https://letterbox-app.org")!, options: [:], completionHandler: nil)
                                     self.dismiss(animated: false, completion: nil)
                                 }))
                             alert.addAction(UIAlertAction(title: NSLocalizedString("scanDifferentCode", comment: ""), style: .default, handler: {
diff --git a/enzevalos_iphone/SecretKey+CoreDataProperties.swift b/enzevalos_iphone/SecretKey+CoreDataProperties.swift
index 2bb74ef73356cf506c1b719f73363cc827d32043..47d468117e3f0405a370242a77bf88c526e708ac 100644
--- a/enzevalos_iphone/SecretKey+CoreDataProperties.swift
+++ b/enzevalos_iphone/SecretKey+CoreDataProperties.swift
@@ -10,19 +10,39 @@
 import Foundation
 import CoreData
 
-
+/**
+ 
+ */
 extension SecretKey {
 
     @nonobjc public class func fetchRequest() -> NSFetchRequest<SecretKey> {
         return NSFetchRequest<SecretKey>(entityName: "SecretKey")
     }
 
+    /**
+     Did we exported the secretkey?
+     */
     @NSManaged public var exported: Bool
+    /**
+     When did we import the secretkey?
+     */
     @NSManaged public var importedDate: NSDate?
     @NSManaged public var keyID: String
+    /**
+     Used in the travler scenario. Just ignore it.
+     */
     @NSManaged public var obsolete: Bool
+    /**
+     Not used yet. Should store how we imported the key (generated on device, imported from mail via autorcrypt, via iTunes, ...)
+     */
     @NSManaged public var origin: Int16
+    /**
+     Just added in case of multiple accounts.
+     */
     @NSManaged public var account: Account?
+    /**
+     A Set of mails where as the key was used for decryption.
+     */
     @NSManaged public var decryptedMails: NSSet?
 
 }
diff --git a/enzevalos_iphone/SendViewController+Invitation.swift b/enzevalos_iphone/SendViewController+Invitation.swift
index 1ee39ebdfbe71d07cae19a17521fbbb0870cddc7..1955b6de249abee2828c13f020e3583a966a28d5 100644
--- a/enzevalos_iphone/SendViewController+Invitation.swift
+++ b/enzevalos_iphone/SendViewController+Invitation.swift
@@ -229,7 +229,7 @@ extension SendViewController {
             
             controller?.additionalAction = {
                 controller?.hideDialog(completion: nil)
-                UIApplication.shared.openURL(URL(string: TravelHandler.website)!)
+                UIApplication.shared.open(URL(string: TravelHandler.website)!, options: [:], completionHandler: nil)
             }
             
             controller?.dismissAction = {
diff --git a/enzevalos_iphone/SendViewController.swift b/enzevalos_iphone/SendViewController.swift
index ebab5f5d1ca5121a546f9c7bda97652c65d85723..a867fd807ef4dd3ec5af49870043cf61032fbfca 100644
--- a/enzevalos_iphone/SendViewController.swift
+++ b/enzevalos_iphone/SendViewController.swift
@@ -390,18 +390,10 @@ class SendViewController: UIViewController {
                     scrollview.isScrollEnabled = false
                     scrollview.contentOffset = CGPoint(x: 0, y: tokenField.frame.origin.y - self.topLayoutGuide.length)
                     tableviewBegin.constant = tokenField.frame.maxY - tokenField.frame.origin.y
-                    if #available(iOS 11.0, *) {
-                        if keyboardY > 0 {
-                            tableviewHeight.constant = keyboardY - tableviewBegin.constant
-                        } else {
-                            tableviewHeight.constant = view.safeAreaLayoutGuide.layoutFrame.size.height - tableviewBegin.constant
-                        }
+                    if keyboardY > 0 {
+                        tableviewHeight.constant = keyboardY - tableviewBegin.constant
                     } else {
-                        if keyboardY > 0 {
-                            tableviewHeight.constant = keyboardY - tableviewBegin.constant - (self.navigationController?.navigationBar.frame.maxY)!
-                        } else {
-                            tableviewHeight.constant = view.bounds.size.height - tableviewBegin.constant - (self.navigationController?.navigationBar.frame.maxY)!
-                        }
+                        tableviewHeight.constant = view.safeAreaLayoutGuide.layoutFrame.size.height - tableviewBegin.constant
                     }
                 } else if !scrollview.isScrollEnabled {
                     scrollview.isScrollEnabled = true
@@ -528,7 +520,7 @@ class SendViewController: UIViewController {
                 self.view.layoutIfNeeded()
             }, completion: nil)
         } else {
-            var info = notification.userInfo!
+            let info = notification.userInfo!
             let keyboardFrame: CGRect = (info[UIResponder.keyboardFrameEndUserInfoKey] as! NSValue).cgRectValue
             keyboardY = keyboardFrame.origin.y
             if keyboardHeight == 0 {
diff --git a/enzevalos_iphone/TempAttachment.swift b/enzevalos_iphone/TempAttachment.swift
index 710201b45a108e3e9fc0a9f1c13bef2e4e6489d0..2877cc85f90bab9cf8fde6a8692fc4dbf4ad58fe 100644
--- a/enzevalos_iphone/TempAttachment.swift
+++ b/enzevalos_iphone/TempAttachment.swift
@@ -39,8 +39,6 @@ enum MIMETYPE: String {
 
 class TempAttachment: Hashable {
     
-    var hashValue: Int
-
     var name: String
     var data: Data
     var mimeType: MIMETYPE
@@ -54,7 +52,6 @@ class TempAttachment: Hashable {
         self.mimeType = mimeType
         self.encState = encState
         self.sigState = sigState
-        self.hashValue = (name+mimeType.rawValue).hashValue
     }
     
     func store(mail: PersistentMail) {
@@ -71,4 +68,8 @@ class TempAttachment: Hashable {
         }
         return false
     }
+    
+    func hash(into hasher: inout Hasher) {
+        hasher.combine((name+mimeType.rawValue).hashValue)
+    }
 }
diff --git a/enzevalos_iphone/TravelHandler.swift b/enzevalos_iphone/TravelHandler.swift
index 58c78f0335806fd2e81b9b1d046961a1e1ca0d07..667218d883bc9bb79583cd67a4944d4a195270ba 100644
--- a/enzevalos_iphone/TravelHandler.swift
+++ b/enzevalos_iphone/TravelHandler.swift
@@ -423,7 +423,7 @@ public class TravelHandler {
             }
         }
         controllers.append(description1)
-        let descriptionViewController2 = IntroButtonViewController.storyboardInstance(description: NSLocalizedString("TravelIntroOverview", comment: ""), buttonAction: {_ in UIApplication.shared.openURL(URL(string: TravelHandler.website)!)})!
+        let descriptionViewController2 = IntroButtonViewController.storyboardInstance(description: NSLocalizedString("TravelIntroOverview", comment: ""), buttonAction: {_ in UIApplication.shared.open(URL(string: TravelHandler.website)!, options: [:], completionHandler: nil)})!
         descriptionViewController2.buttonText = NSLocalizedString("MoreInformation", comment: "get more info at our website")
         controllers.append(descriptionViewController2)
         let overviewController1 = IntroDescriptionViewController.storyboardInstance(description: NSLocalizedString("TravelIntroOverviewAtHome", comment: ""), descriptionImage: TravelHandler.homeIcon)!
@@ -456,7 +456,7 @@ public class TravelHandler {
         }
         let describeSecretController = IntroButtonViewController.storyboardInstance(description: NSLocalizedString("Travel.Prepare.ShouldShowPassword.Description", comment: ""), buttonText: NSLocalizedString("Continue", comment: ""), titleText: "Passwort merken", titleDescription: NSLocalizedString("Travel.Prepare.ShouldShowPassword.TitleDescription", comment: ""))!
         let secretController = IntroSecretViewController.storyboardInstance(description: NSLocalizedString("Travel.Prepare.PresentSecret.Description", comment: ""), secret: "s", titleText: "Passwort merken", titleDescription: "Merke dir das Passwort gut, du benötigst es nach deinem Grenzübertritt, um wieder sicher kommunizieren zu können.", alternateText: NSLocalizedString("Travel.Prepare.PresentSecret.wrongSecret.Description", comment: ""))!
-        let recommendationsController = IntroButtonViewController.storyboardInstance(description: "Wenn du an der Grenze kontrolliert wirst, liegt es in deinem Ermessen, wie stark du mit den Kontrolleuren kooperierst. Kooperierst du nicht, kann es u.a. sein, dass du Strafen zahlen musst. Wenn du Zugang zu Daten von dir lässt, betone vorher ausdrücklich, dass es nicht in deinem Einverständnis passiert. Bleibe dabei jedoch ruhig.\nBehalte deine Geräte die ganze Zeit über im Auge und lüge die Kontrolleure nicht an.\nKurz vor der Kontrolle solltest du deine Geräte ausschalten.", buttonAction: {_ in UIApplication.shared.openURL(URL(string: TravelHandler.website)!)}, titleText: "Während der Kontrolle", titleDescription: "Beachte die dargestellten Hinweise, falls du und deine Geräte kontrolliert werden. Für weitere Hinweise und Informationen besuche unsere Webseite.")!
+        let recommendationsController = IntroButtonViewController.storyboardInstance(description: "Wenn du an der Grenze kontrolliert wirst, liegt es in deinem Ermessen, wie stark du mit den Kontrolleuren kooperierst. Kooperierst du nicht, kann es u.a. sein, dass du Strafen zahlen musst. Wenn du Zugang zu Daten von dir lässt, betone vorher ausdrücklich, dass es nicht in deinem Einverständnis passiert. Bleibe dabei jedoch ruhig.\nBehalte deine Geräte die ganze Zeit über im Auge und lüge die Kontrolleure nicht an.\nKurz vor der Kontrolle solltest du deine Geräte ausschalten.", buttonAction: {_ in UIApplication.shared.open(URL(string: TravelHandler.website)!, options: [:], completionHandler: nil)}, titleText: "Während der Kontrolle", titleDescription: "Beachte die dargestellten Hinweise, falls du und deine Geräte kontrolliert werden. Für weitere Hinweise und Informationen besuche unsere Webseite.")!
         recommendationsController.buttonText = NSLocalizedString("MoreInformation", comment: "get more info at our website")
         let pageViewController = IntroPageViewController.storyboardInstance(orderedViewControllers: controllers, titleText: "Vorbereitung", titleDescription: "In diesem Schritt wird dir das Verfahren kurz erläutert. Eine Sicherung wird automatisch erstellt.")
         
@@ -511,13 +511,13 @@ public class TravelHandler {
         let askCompromiseController = IntroYesNoViewController.storyboardInstance(description: "Hier solltest du nur fortfahren, wenn du die Grenzkontrollen hinter dir gelassen hast und dir keine weitere bevor steht, bis du an deinem Ziel ankommst!\n\nWurden während der Kontrolle weitere Geräte z.B. per Kabel mit deinem Smartphone verbunden oder wurde es dir mal abgenommen und aus deinem Sichtfeld entfernt?", titleText: "Grenze übertreten", titleDescription: "Wenn du die Grenze übertreten hast, kannst du hier im weiteren Verlauf dein Passwort eingeben und im Anschluss wieder Briefe austauschen.")!
         let compromisedController = IntroDescriptionViewController.storyboardInstance(description: "Du solltest dein Smartphone am Besten nicht mehr verwenden! Du kannst ihm nicht mehr trauen, da es nicht mehr auszuschließen ist, dass Schadprogramme darauf installiert sind, die dich und deine Kommunikation überwachen. Diese kann man nicht mit Sicherheit entfernen und man sieht im Zweifelsfall auch nicht. \n\nDu kannst jetzt wieder Briefe austauschen. Es ist allerdings nun auch bei Briefen möglich, dass sie von Dritten mitgelesen und gefälscht werden! Traue keiner Kommunikation, die mit diesem Gerät passiert!", titleText: "Unsicheres Smartphone", titleDescription: "Traue keiner Kommunikation mehr, die über dieses Smartphone passiert! Für weitere Informationen besuche unsere Webseite.")!
         compromisedController.doneText = NSLocalizedString("Next", comment: "present next viewcontroller")
-        let compromisedController2 = IntroButtonViewController.storyboardInstance(description: "Bitte setze dich mit uns in Verbindung und berichte von deiner Grenzkontrolle! Das dient uns, um einen generellen Überblick über das Eindringen in Privatsphäre bei Grenzkontrollen zu erhalten und damit die App zu verbessern. Im Einzelfall können wir auch vorgehensweisen und Lösungen für künftige Reisen besprechen, wenn du das wünscht.", buttonAction: {_ in UIApplication.shared.openURL(URL(string: TravelHandler.website)!)}, buttonText: "Erfahrungen berichten", titleText: "Erfahrungsbericht", titleDescription: "Eine so ausführliche Kontrolle, wie sie bei dir durchgeführt wurde, passiert nicht häufig. Bitte teile uns genaueres über die Umstände mit!")!
+        let compromisedController2 = IntroButtonViewController.storyboardInstance(description: "Bitte setze dich mit uns in Verbindung und berichte von deiner Grenzkontrolle! Das dient uns, um einen generellen Überblick über das Eindringen in Privatsphäre bei Grenzkontrollen zu erhalten und damit die App zu verbessern. Im Einzelfall können wir auch vorgehensweisen und Lösungen für künftige Reisen besprechen, wenn du das wünscht.", buttonAction: {_ in UIApplication.shared.open(URL(string: TravelHandler.website)!, options: [:], completionHandler: nil)}, buttonText: "Erfahrungen berichten", titleText: "Erfahrungsbericht", titleDescription: "Eine so ausführliche Kontrolle, wie sie bei dir durchgeführt wurde, passiert nicht häufig. Bitte teile uns genaueres über die Umstände mit!")!
         let insertPasswordController = IntroInputViewController.storyboardInstance(description: "Gib nun das Passwort ein, das du dir vor dem Grenzübertritt merken solltest:", titleText: "Passwort eingeben", titleDescription: "Vor dem Grenzübertritt musstest du dir ein Passwort merken. Gib dieses hier bitte ein.")!
         insertPasswordController.doneText = NSLocalizedString("Next", comment: "present next viewcontroller")
         let corruptDataController = IntroDescriptionViewController.storyboardInstance(description: "Du kannst nun wieder Briefe schicken. Jedoch wurden besondere Daten auf deinem Telefon verändert. Dadurch ist es möglich, dass du oder deine Kontakte Briefe mit jemandem austauschen, der sich als du oder einer deiner Kontakte ausgeben kann, ohne dass euch das aufällt.\n\nDeine Kontakte wissen nun evtl. auch, dass ihr nicht von der Identität des jeweils anderen überzeugt sein könnt. Sei nicht irritiert, wenn sie dich auf anderem Wege kontaktieren und sich nach dir erkundigen.", titleText: "Veränderte Daten", titleDescription: "Es wurden Daten auf deinem Smartphone verändert. Das kann dazu führen, dass auch Briefe nicht mehr sicher sind. Sei vorsichtig, was du schreibst.")! //We could mention a wrong password here too
         corruptDataController.doneText = NSLocalizedString("Next", comment: "present next viewcontroller")
-        let corruptDataController2 = IntroButtonViewController.storyboardInstance(description: "Die Veränderung der Daten auf deinem Telefon passierte vermutlich während der Grenzkontrolle durch Kontrolleure. Um uns einen generellen Überblick über das Eindringen in Privatsphäre bei Grenzkontrollen zu geben und damit die App zu verbessern, würde es uns sehr freuen, wenn du uns einen kurzen Bericht über deine Erfahrungen mit Grenzkontrollen hinterlassen würdest!", buttonAction: {_ in UIApplication.shared.openURL(URL(string: TravelHandler.website)!)}, buttonText: "Erfahrungsbericht hinterlassen", titleText: "Erfahrungsbericht", titleDescription: "Dass bei einer Kontrolle Daten verändert werden, passiert nicht häufig. Bitte teile uns genaueres über die Umstände mit!")!
-        let doneController = IntroButtonViewController.storyboardInstance(description: "Super, du kannst nun wieder Briefe schreiben!\n\nUm dieses Feature zu verbessern und einen generellen Überblick über das Eindringen in Privatsphäre bei Grenzkontrollen zu haben, würde es uns sehr freuen, wenn du uns einen kurzen Bericht über deine Erfahrungen mit Grenzkontrollen hinterlassen würdest!", buttonAction: {_ in UIApplication.shared.openURL(URL(string: TravelHandler.website)!)}, buttonText: "Erfahrungsbericht hinterlassen", titleText: "Fertig!", titleDescription: "Du kannst nun wieder Briefe schreiben.")!
+        let corruptDataController2 = IntroButtonViewController.storyboardInstance(description: "Die Veränderung der Daten auf deinem Telefon passierte vermutlich während der Grenzkontrolle durch Kontrolleure. Um uns einen generellen Überblick über das Eindringen in Privatsphäre bei Grenzkontrollen zu geben und damit die App zu verbessern, würde es uns sehr freuen, wenn du uns einen kurzen Bericht über deine Erfahrungen mit Grenzkontrollen hinterlassen würdest!", buttonAction: {_ in UIApplication.shared.open(URL(string: TravelHandler.website)!, options: [:], completionHandler: nil)}, buttonText: "Erfahrungsbericht hinterlassen", titleText: "Erfahrungsbericht", titleDescription: "Dass bei einer Kontrolle Daten verändert werden, passiert nicht häufig. Bitte teile uns genaueres über die Umstände mit!")!
+        let doneController = IntroButtonViewController.storyboardInstance(description: "Super, du kannst nun wieder Briefe schreiben!\n\nUm dieses Feature zu verbessern und einen generellen Überblick über das Eindringen in Privatsphäre bei Grenzkontrollen zu haben, würde es uns sehr freuen, wenn du uns einen kurzen Bericht über deine Erfahrungen mit Grenzkontrollen hinterlassen würdest!", buttonAction: {_ in UIApplication.shared.open(URL(string: TravelHandler.website)!, options: [:], completionHandler: nil)}, buttonText: "Erfahrungsbericht hinterlassen", titleText: "Fertig!", titleDescription: "Du kannst nun wieder Briefe schreiben.")!
         
         askCompromiseController.yesAction = {_ in
             self.handleCorruption()
diff --git a/enzevalos_iphone/de.lproj/Localizable.strings b/enzevalos_iphone/de.lproj/Localizable.strings
index 97464c7c8a6c6cab94a9acb3e521d03653f5275a..0eda774b5f7aebf7e635d1d413ad15984b2b4c5c 100644
--- a/enzevalos_iphone/de.lproj/Localizable.strings
+++ b/enzevalos_iphone/de.lproj/Localizable.strings
@@ -279,10 +279,14 @@
 "Invitation.ComposeMail" = "Die E-Mail kannst du nach deinen Wünschen anpassen. Zur wissenschaftlichen Untersuchung wird der Inhalt dieser E-Mail gespeichert.";
 "Mail.Signature" = "\n\n____________________________\n\nVerfasst mit Letterbox. Mehr Informationen: http://letterbox-app.org?invitation=0\n\n";
 "MailServerError.Authentication.Body" = "Es konnte keine Verbindung zum Server hergestellt werden. \n Das Password oder der Accountname ist falsch. Bitte überprüfe beides.";
+
 "MailServerError.Connection.Body" = "Es konnte keine Verbindung zum Server hergestellt werden.\n Bitte überprüfe das Password, der Accountname und die Serverkonfiguration (IMAP/SMTP). Die Serverkonfiguration kann mit der Serverkonfiguration auf der Provider-Webseite verglichen werden. In manchen Fällen muss der Zugriff mittels IMAP/SMTP in den Accounteinstellungen erst freigeschaltet werden.";
 "MailServerError.Crypto.Body" = "Es konnte keine Verbindung zum Server hergestellt werden.\n Die Konfiguration der Transportverschlüsselung ist falsch. Bitte überprüfe diese, sowie den Port der Serverkonfiguration. Mehr Informationen finden sich dazu auch auf der Webseite deines Mail-Providers.";
 "MailServerError.OAUTH.Body" = "Es konnte keine Verbindung zum Server hergestellt werden.\n Google stellt einen sicheren Zugang zu deinem Postfach bereit. Bitte nutze dazu den spezifischen Login für Google.";
 "MailServerError.Default.Body" = "Es konnte keine Verbindung zum Server hergestellt werden.\n Bitte überprüfe das Password, den Accountname und die Serverkonfiguration (IMAP/SMTP). Die Serverkonfiguration kann mit der Serverkonfiguration auf der Provider-Webseite verglichen werden. In manchen Fällen muss der Zugriff mittels IMAP/SMTP in den Accounteinstellungen erst freigeschaltet werden.";
+"MailServerError.IMAP.Body" = "Es konnte keine Verbindung zum Server hergestellt werden.\n Bitte überprüfe die IMAP Serverkonfiguration.";
+"MailServerError.SMTP.Body" = "Es konnte keine Verbindung zum Server hergestellt werden.\n Bitte überprüfe die SMTP Serverkonfiguration.";
+
 "Read.Import.Secret.Title" = "Neuer geheimer Schlüssel";
 "Read.Import.Secret.Body.PW" = "gib zum Importieren das Passwort für den geheimen Schlüssel mit der ID %@ ein.";
 "Read.Import.Secret.Body.Plain" = "Importiere den neuen geheimen Schlüssel mit der ID: %@.";
diff --git a/enzevalos_iphone/en.lproj/Localizable.strings b/enzevalos_iphone/en.lproj/Localizable.strings
index 804abef586940123e918a3a637929b9b55ade4b5..e31af588a2daa284b2e3f808ed88292362df2183 100644
--- a/enzevalos_iphone/en.lproj/Localizable.strings
+++ b/enzevalos_iphone/en.lproj/Localizable.strings
@@ -248,11 +248,15 @@
 "Invitation.EncryptionFooter" = "\n\n____________________________\n\nTeile dieser E-Mail sind vertraulich\n\nThis mail is partially confidential; the email provider and possibly others can read along. Some parts of this message are private or sensitive. They are supposed to remain hidden from other readers and have therefore been blackened.\n\nYour counterpart already uses Letterbox to protect communication from the curious eyes of others. If you join in, both of you will reach the goal together.\n\n you can decrypt the encrypted passages anytime at %@ \n\n"; //TODO
 "Invitation.ComposeMail" = "You can customize the mail to suit your needs. The content of this mail is stored for scientific research.";
 "Mail.Signature" = "\n\n____________________________\n\nComposed with Letterbox. More information: http://letterbox-app.org\n\n";
+
 "MailServerError.Authentication.Body" = "Couldn't connect to server. \n Your account name or password is wrong. Please, check them.";
 "MailServerError.Connection.Body" = "Couldn't connect to server.\n Please, check your account name and server configuration (IMAP, SMTP). You can also compare the server configuration with the configuration listed on the website of your provider. In some cases, you have to active the IMAP/SMTP connection in your account settings.";
 "MailServerError.Crypto.Body" = "Couldn't connect to server.\n The transport encryption configuration is wrong. Please, check the transport encryption and port configuration. You can find more information on your provider's website.";
 "MailServerError.OAUTH.Body" = "Couldn't connect to server.\n Google provides a more secure access to your mail account. Please, use the specific google login.";
 "MailServerError.Default.Body" = "Couldn't connect to server.\n Please, check your account name, password and server configuration. You can also compare the server configuration with the configuration listed on the website of your provider. In some cases, you have to activate the IMAP/SMTP connection in your account settings.";
+"MailServerError.IMAP.Body" = "Couldn't connect to server.\n Please check your IMAP server configuration.";
+"MailServerError.SMTP.Body" = "Couldn't connect to server.\n Please check your SMTP server configuration.";
+
 "Read.Import.Secret.Title" = "New secret";
 "Read.Import.Secret.Body.PW" = "Please, enter the password to import the new secret key with the id: %@.";
 "Read.Import.Secret.Body.Plain" = "Import the new secret key with the id: %@.";
diff --git a/enzevalos_iphone/mail/IncomingMail.swift b/enzevalos_iphone/mail/IncomingMail.swift
index 0ebfafeb90b48fe7b56809ca0a65ed1c87aeb188..1b63dd842c058138db22097eb961c71231b7e283 100644
--- a/enzevalos_iphone/mail/IncomingMail.swift
+++ b/enzevalos_iphone/mail/IncomingMail.swift
@@ -162,6 +162,15 @@ class IncomingMail {
     private var boundary: String?
     private var msgID: String = ""
     private var userAgent: String = ""
+    private var mimeVersion: String = ""
+    private var received: String = ""
+    private var contentType: String = ""
+    private var contentTransferEncoding: String = ""
+    private var contentDisposition: String = ""
+    private var dkimSignature: String = ""
+    private var inReplyTo: String = ""
+    private var xMailer: String = ""
+    
     
     // Body info
     private var secretKey: String? = nil
@@ -660,6 +669,30 @@ class IncomingMail {
             if let agent = header.userAgent {
                 userAgent = agent
             }
+            if let mime = header.extraHeaderValue(forName: HeaderExtractionValues.MIMEVersion.rawValue) {
+               mimeVersion = mime
+            }
+            if let received_h =  header.extraHeaderValue(forName: HeaderExtractionValues.Received.rawValue) {
+                received = received_h
+            }
+            if let content = header.extraHeaderValue(forName: HeaderExtractionValues.ContentType.rawValue){
+                contentType = content
+            }
+            if let contentTransEncode = header.extraHeaderValue(forName: HeaderExtractionValues.ContentTransferEncoding.rawValue){
+                contentTransferEncoding = contentTransEncode
+            }
+            if let contentDispos =  header.extraHeaderValue(forName: HeaderExtractionValues.ContentDisposition.rawValue) {
+                contentDisposition = contentDispos
+            }
+            if let dkimSig =  header.extraHeaderValue(forName: HeaderExtractionValues.DKIMSignature.rawValue){
+                dkimSignature = dkimSig
+            }
+            if let inReplyToo = header.extraHeaderValue(forName: HeaderExtractionValues.InReplyTo.rawValue){
+                inReplyTo = inReplyToo
+            }
+            if let xMail = header.extraHeaderValue(forName: HeaderExtractionValues.XMailer.rawValue){
+                xMailer = xMail
+            }
             boundary = findBoundary()
         }
     }
diff --git a/enzevalos_iphoneTests/CoreDataTests.swift b/enzevalos_iphoneTests/CoreDataTests.swift
index 3a4b1a3707fe445cfa81966c74d37778ad2f82c9..68cbb78f224b3c18010b2ea0aa8b43525db492dd 100644
--- a/enzevalos_iphoneTests/CoreDataTests.swift
+++ b/enzevalos_iphoneTests/CoreDataTests.swift
@@ -74,29 +74,33 @@ class CoraDataTests: XCTestCase {
         else {
             return
         }
-        let m1 = testMail(from: from, to: [user], cc: [], bcc: [])
-        m1?.unableToDecrypt = true
-        m1?.secretKey = datahandler.createNewSecretKey(adr: "sender@example.com").keyID
-        print("M1 body: ", m1?.body)
+        guard let m1 = testMail(from: from, to: [user], cc: [], bcc: []) else {
+            XCTFail("Could not create test mails")
+            return
+        }
+        m1.unableToDecrypt = true
+        m1.secretKey = datahandler.createNewSecretKey(adr: "sender@example.com").keyID
         
-        let m2 = testMail(from: from, to: [user], cc: [], bcc: [])
-        m2?.unableToDecrypt = false
-        m2?.secretKey = datahandler.createNewSecretKey(adr: "sender@example.com").keyID
-        print("M2 body: ", m2?.body)
+        guard let m2 = testMail(from: from, to: [user], cc: [], bcc: []) else {
+            XCTFail("Could not create test mails")
+            return
+        }
+        m2.unableToDecrypt = false
+        m2.secretKey = datahandler.createNewSecretKey(adr: "sender@example.com").keyID
 
-        let m3 = testMail(from: from, to: [user], cc: [], bcc: [])
-        m3?.unableToDecrypt = true
-        m3?.secretKey = datahandler.createNewSecretKey(adr: "sender@example.com").keyID
-        print("M3 body: ", m3?.body)
+        guard let m3 = testMail(from: from, to: [user], cc: [], bcc: []) else {
+            XCTFail("Could not create test mails")
+            return
+        }
+        m3.unableToDecrypt = true
+        m3.secretKey = datahandler.createNewSecretKey(adr: "sender@example.com").keyID
 
-        datahandler.save(during: "")
+        datahandler.save(during: "manipulate test mails")
         
         let mailList = datahandler.getAllNotDecryptedPersistentMail()
         XCTAssertEqual(mailList.count, 2, "Wrong length:  \(mailList.count)")
         for mail in mailList {
             XCTAssertEqual(mail.unableToDecrypt, true, "Mail is unable to decrypt. The encryption state is: \(mail.encState)")
-            //print("body: ", mail.body)
-            
         }
     }