diff --git a/enzevalos_iphone.xcodeproj/project.pbxproj b/enzevalos_iphone.xcodeproj/project.pbxproj
index d4ffdf6d1d3f1972b94926a0368b8f7f159218b8..639e9fd428cde9bd47c29009466077a90c01a7e2 100644
--- a/enzevalos_iphone.xcodeproj/project.pbxproj
+++ b/enzevalos_iphone.xcodeproj/project.pbxproj
@@ -534,6 +534,7 @@
 		47CEF4EA2052C3C700887CDB /* ObjectivePGP.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = ObjectivePGP.framework; sourceTree = "<group>"; };
 		47CEF4EC2052C3E600887CDB /* ObjectivePGP.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ObjectivePGP.framework; path = ../enzevalos_iphone_workspace/ObjectivePGP.framework; sourceTree = "<group>"; };
 		47D1302A1F7CEE6D007B14DF /* DebugSettings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DebugSettings.swift; sourceTree = "<group>"; };
+		47D1BB052431F81C001F1EC9 /* enzevalos_iphone 10.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "enzevalos_iphone 10.xcdatamodel"; sourceTree = "<group>"; };
 		47E7376D22845EC400972401 /* SecretKeyTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecretKeyTableViewController.swift; sourceTree = "<group>"; };
 		47E7376F22845F3A00972401 /* KeyViews.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = KeyViews.storyboard; sourceTree = "<group>"; };
 		47E737732284610E00972401 /* KeyCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KeyCell.xib; sourceTree = "<group>"; };
@@ -2710,6 +2711,7 @@
 		A135267F1D955BDF00D3BFE1 /* enzevalos_iphone.xcdatamodeld */ = {
 			isa = XCVersionGroup;
 			children = (
+				47D1BB052431F81C001F1EC9 /* enzevalos_iphone 10.xcdatamodel */,
 				670159DF240FB4E800797FA5 /* enzevalos_iphone 9.xcdatamodel */,
 				4751C6FD2344D169006B2A4D /* enzevalos_iphone 8.xcdatamodel */,
 				4751C6F0233CE1E4006B2A4D /* enzevalos_iphone 7.xcdatamodel */,
@@ -2720,7 +2722,7 @@
 				47B2318A1F0D458100961B28 /* enzevalos_iphone 2.xcdatamodel */,
 				A13526801D955BDF00D3BFE1 /* enzevalos_iphone.xcdatamodel */,
 			);
-			currentVersion = 670159DF240FB4E800797FA5 /* enzevalos_iphone 9.xcdatamodel */;
+			currentVersion = 47D1BB052431F81C001F1EC9 /* enzevalos_iphone 10.xcdatamodel */;
 			path = enzevalos_iphone.xcdatamodeld;
 			sourceTree = "<group>";
 			versionGroupType = wrapper.xcdatamodel;
diff --git a/enzevalos_iphone/DataHandler.swift b/enzevalos_iphone/DataHandler.swift
index 402f99c00c383dced15b6323e628c6a4c7ec60c5..526fd60ec58f759624265a08b14774e661971805 100644
--- a/enzevalos_iphone/DataHandler.swift
+++ b/enzevalos_iphone/DataHandler.swift
@@ -1025,6 +1025,14 @@ class DataHandler {
         }
         record.addToPersistentMails(mail)
         mail.folder.addToKeyRecords(record)
+        if record.firstMail == nil {
+            record.firstMail = mail
+        } else if let first = record.firstMail, mail < first {
+            record.firstMail = mail
+            record.secondMail = first
+        } else if let second = record.secondMail, mail < second {
+            record.secondMail = mail
+        }
         let isInbox = mail.folder.path == Folder.inbox.path
         
         if record.newestDate == nil, isInbox {
diff --git a/enzevalos_iphone/KeyRecord+CoreDataProperties.swift b/enzevalos_iphone/KeyRecord+CoreDataProperties.swift
index c2166ee2452294ea492434b3dfd39ece063832c2..c308ac8f85442f79876d804a7af68be2963e6c2f 100644
--- a/enzevalos_iphone/KeyRecord+CoreDataProperties.swift
+++ b/enzevalos_iphone/KeyRecord+CoreDataProperties.swift
@@ -34,6 +34,9 @@ extension KeyRecord {
     @NSManaged public var persistentMails: NSSet?
     @NSManaged public var newestDate: Date?
     @NSManaged public var nick: String?
+    @NSManaged public var firstMail: PersistentMail?
+    @NSManaged public var secondMail: PersistentMail?
+
 
 
     var activeKey: PersistentKey? {
@@ -49,7 +52,7 @@ extension KeyRecord {
             }
         }
     }
-    
+        
 }
 
 // MARK: Generated accessors for persitentMails
@@ -57,7 +60,6 @@ extension KeyRecord {
 
     @objc(addPersistentMailsObject:)
     @NSManaged public func addToPersistentMails(_ value: PersistentMail)
-
     @objc(removePersistentMailsObject:)
     @NSManaged public func removeFromPersistentMails(_ value: PersistentMail)
 
@@ -90,3 +92,21 @@ extension KeyRecord {
         return request
     }
 }
+
+extension KeyRecord{
+    static func findFirstMails(){
+        let allRecord = DataHandler.handler.getAllKeyRecords()
+        for rec in allRecord {
+            if rec.firstMail == nil {
+                rec.firstMail = rec.mails.first
+            }
+            if rec.secondMail == nil && rec.mails.count > 1 {
+                rec.secondMail = rec.mails[1]
+            }
+            if rec.firstMail == nil {
+                print("Empty record: \(rec.name)")
+            }
+        }
+        DataHandler.handler.save(during: "Fix first mails")
+    }
+}
diff --git a/enzevalos_iphone/SwiftUI/Inbox/Inbox.swift b/enzevalos_iphone/SwiftUI/Inbox/Inbox.swift
index d60d23f84c60750afab0734f02575ae7029d150e..27f5be96ccb68709609d0c06c7ed18fe26ffc984 100644
--- a/enzevalos_iphone/SwiftUI/Inbox/Inbox.swift
+++ b/enzevalos_iphone/SwiftUI/Inbox/Inbox.swift
@@ -48,7 +48,7 @@ struct Inbox: View {
     private var mailList: some View {
         List (self.keyrecords.filter(filterKeyRecord), id: \.self){
             record in
-            KeyRecordRow(keyrecord: record, coord: self.coord).environment(\.managedObjectContext, self.managedObjectContext)
+            KeyRecordRow(keyrecord: record, coord: self.coord)
        }
        .resignKeyboardOnDragGesture() // hide keyboard when dragging
     }
@@ -142,3 +142,4 @@ struct Inbox_Previews: PreviewProvider {
     }
 }
  */
+
diff --git a/enzevalos_iphone/SwiftUI/Inbox/InboxCoordinator.swift b/enzevalos_iphone/SwiftUI/Inbox/InboxCoordinator.swift
index 6a3663022e242f5f4f2b9e66fcc2dd3ebd9f29f8..e90d1d6c611f30f8ca5df1223046e38b54848333 100644
--- a/enzevalos_iphone/SwiftUI/Inbox/InboxCoordinator.swift
+++ b/enzevalos_iphone/SwiftUI/Inbox/InboxCoordinator.swift
@@ -39,6 +39,7 @@ class InboxCoordinator {
             }
         }
         else {
+            KeyRecord.findFirstMails()
             let context = DataHandler.handler.managedObjectContext
             let vc = UIHostingController(rootView: Inbox(coord: self).environment(\.managedObjectContext, context))
             inbox = vc
diff --git a/enzevalos_iphone/SwiftUI/Inbox/KeyRecordRow.swift b/enzevalos_iphone/SwiftUI/Inbox/KeyRecordRow.swift
index 4c85251804dddf30d59c5173a2369d8ab0e06bf5..87ec4a2526fa1966cf858407d5bac49942b4c39e 100644
--- a/enzevalos_iphone/SwiftUI/Inbox/KeyRecordRow.swift
+++ b/enzevalos_iphone/SwiftUI/Inbox/KeyRecordRow.swift
@@ -9,26 +9,19 @@
 import SwiftUI
 
 struct KeyRecordRow: View {
-    @Environment(\.managedObjectContext) var managedObjectContext
 
     var keyrecord: KeyRecord
     let coord: InboxCoordinator
+    var first: PersistentMail?
+    var second: PersistentMail?
     
-    var fetchRequest: FetchRequest<PersistentMail>
-    var mails: FetchedResults<PersistentMail> {
-        fetchRequest.wrappedValue
-    }
-
     init(keyrecord: KeyRecord, coord: InboxCoordinator) {
         self.keyrecord = keyrecord
         self.coord = coord
-        let pred = NSPredicate(format: "record == %@", keyrecord)
-        let folderPredicate = NSPredicate(format: "folder == %@", Folder.inbox)
-        let predicates = NSCompoundPredicate(andPredicateWithSubpredicates: [pred, folderPredicate])
-        let sortDescriptors = [NSSortDescriptor(key: "date", ascending: false)]
-        fetchRequest = FetchRequest<PersistentMail>(entity: PersistentMail.entity(), sortDescriptors: sortDescriptors, predicate: predicates, animation: nil)
+        first = keyrecord.firstMail
+        second = keyrecord.secondMail
     }
-    
+
     
     var body: some View {
         VStack {
@@ -46,13 +39,6 @@ struct KeyRecordRow: View {
         }
     }
     
-    var secondMail: PersistentMail?{
-        if mails.count > 1 {
-            return mails[2]
-        }
-        return nil
-    }
-    
     /*
      Displays the first (and second) mail
      */
@@ -60,11 +46,11 @@ struct KeyRecordRow: View {
         let spacing = CGFloat(10)
         let offset = -(spacing / 2)
         
-        if let first = mails.first {
-            if mails.count > 1 {
+        if let first = self.first {
+            if let second = self.second {
                 return AnyView(VStack(alignment: .leading, spacing: spacing) {
                         MailView(mail: first, coord: coord)
-                        MailView(mail: mails[1], coord: coord)
+                        MailView(mail: second, coord: coord)
                         .background(Stroke(offsetY: offset))
                 })
             } else {
@@ -107,24 +93,3 @@ struct KeyRecordRow: View {
         })
     }
 }
-
-
-extension KeyRecord {
-    
-    public var firstMail: PersistentMail? {
-        get {
-            return mails.first
-        }
-    }
-    
-    public var secondMail: PersistentMail? {
-        get {
-            if mails.count > 1 {
-                return mails[1]
-            }
-            return nil
-        }
-    }
-}
-
-
diff --git a/enzevalos_iphone/enzevalos_iphone.xcdatamodeld/.xccurrentversion b/enzevalos_iphone/enzevalos_iphone.xcdatamodeld/.xccurrentversion
index 8723d24cbe7999b90840d81bec8c2e4809b58ee6..fa8416cffd55eab648ab8a1e71b0f7d54706fc10 100644
--- a/enzevalos_iphone/enzevalos_iphone.xcdatamodeld/.xccurrentversion
+++ b/enzevalos_iphone/enzevalos_iphone.xcdatamodeld/.xccurrentversion
@@ -3,6 +3,6 @@
 <plist version="1.0">
 <dict>
 	<key>_XCCurrentVersionName</key>
-	<string>enzevalos_iphone 9.xcdatamodel</string>
+	<string>enzevalos_iphone 10.xcdatamodel</string>
 </dict>
 </plist>
diff --git a/enzevalos_iphone/enzevalos_iphone.xcdatamodeld/enzevalos_iphone 10.xcdatamodel/contents b/enzevalos_iphone/enzevalos_iphone.xcdatamodeld/enzevalos_iphone 10.xcdatamodel/contents
new file mode 100644
index 0000000000000000000000000000000000000000..92675aef3d195c73ab3e53760230085a470d840f
--- /dev/null
+++ b/enzevalos_iphone/enzevalos_iphone.xcdatamodeld/enzevalos_iphone 10.xcdatamodel/contents	
@@ -0,0 +1,182 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="16119" systemVersion="19D76" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
+    <entity name="Account" representedClassName="Account" syncable="YES" codeGenerationType="class">
+        <attribute name="archiveFolderPath" attributeType="String"/>
+        <attribute name="displayName" attributeType="String"/>
+        <attribute name="draftFolderPath" attributeType="String"/>
+        <attribute name="inboxFolderPath" attributeType="String"/>
+        <attribute name="loginName" attributeType="String"/>
+        <attribute name="prefEnc" optional="YES" attributeType="String"/>
+        <attribute name="prefMailAdr" optional="YES" attributeType="String"/>
+        <attribute name="prefSecretKeyID" optional="YES" attributeType="String"/>
+        <attribute name="sentFolderPath" attributeType="String"/>
+        <attribute name="trashFolderPath" attributeType="String"/>
+        <relationship name="aliase" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Mail_Address" inverseName="account" inverseEntity="Mail_Address"/>
+        <relationship name="imap" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Server" inverseName="imap" inverseEntity="Server"/>
+        <relationship name="keys" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="SecretKey" inverseName="account" inverseEntity="SecretKey"/>
+        <relationship name="smtp" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Server" inverseName="smtp" inverseEntity="Server"/>
+    </entity>
+    <entity name="Attachment" representedClassName="Attachment" syncable="YES" codeGenerationType="class">
+        <attribute name="contentID" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
+        <attribute name="data" attributeType="Binary"/>
+        <attribute name="encryptionState" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
+        <attribute name="isExplicitAttachment" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
+        <attribute name="mcoPartType" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
+        <attribute name="mimeType" attributeType="String"/>
+        <attribute name="name" attributeType="String"/>
+        <attribute name="signatureState" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
+        <relationship name="mail" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="PersistentMail" inverseName="attachments" inverseEntity="PersistentMail"/>
+        <relationship name="parentOf" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Attachment" inverseName="partOf" inverseEntity="Attachment"/>
+        <relationship name="partOf" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Attachment" inverseName="parentOf" inverseEntity="Attachment"/>
+    </entity>
+    <entity name="EnzevalosContact" representedClassName="EnzevalosContact" syncable="YES">
+        <attribute name="cnidentifier" optional="YES" attributeType="String"/>
+        <attribute name="color" optional="YES" attributeType="Transformable" customClassName="UIColor"/>
+        <attribute name="displayname" attributeType="String"/>
+        <relationship name="addresses" toMany="YES" deletionRule="Cascade" destinationEntity="Mail_Address" inverseName="contact" inverseEntity="Mail_Address"/>
+        <relationship name="keyrecords" optional="YES" toMany="YES" deletionRule="Cascade" destinationEntity="KeyRecord" inverseName="contact" inverseEntity="KeyRecord"/>
+    </entity>
+    <entity name="Folder" representedClassName="Folder" syncable="YES">
+        <attribute name="delimiter" optional="YES" attributeType="String"/>
+        <attribute name="flags" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
+        <attribute name="icon" optional="YES" attributeType="String"/>
+        <attribute name="lastUpdate" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
+        <attribute name="maxID" optional="YES" attributeType="Decimal" defaultValueString="1"/>
+        <attribute name="minUID" optional="YES" attributeType="Decimal" defaultValueString="0.0"/>
+        <attribute name="path" attributeType="String"/>
+        <attribute name="pseudonym" attributeType="String"/>
+        <attribute name="uidvalidity" optional="YES" attributeType="Decimal" defaultValueString="0.0"/>
+        <relationship name="keyRecords" optional="YES" toMany="YES" deletionRule="Nullify" ordered="YES" destinationEntity="KeyRecord" inverseName="folder" inverseEntity="KeyRecord"/>
+        <relationship name="mails" optional="YES" toMany="YES" deletionRule="Nullify" ordered="YES" destinationEntity="PersistentMail" inverseName="folder" inverseEntity="PersistentMail"/>
+        <relationship name="parent" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Folder" inverseName="subfolder" inverseEntity="Folder"/>
+        <relationship name="subfolder" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Folder" inverseName="parent" inverseEntity="Folder"/>
+    </entity>
+    <entity name="KeyRecord" representedClassName="KeyRecord" syncable="YES">
+        <attribute name="newestDate" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
+        <attribute name="nick" optional="YES" attributeType="String"/>
+        <relationship name="contact" maxCount="1" deletionRule="Nullify" destinationEntity="EnzevalosContact" inverseName="keyrecords" inverseEntity="EnzevalosContact"/>
+        <relationship name="firstMail" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="PersistentMail"/>
+        <relationship name="folder" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Folder" inverseName="keyRecords" inverseEntity="Folder"/>
+        <relationship name="key" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="PersistentKey" inverseName="record" inverseEntity="PersistentKey"/>
+        <relationship name="persistentMails" optional="YES" toMany="YES" deletionRule="Nullify" ordered="YES" destinationEntity="PersistentMail" inverseName="record" inverseEntity="PersistentMail"/>
+        <relationship name="secondMail" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="PersistentMail"/>
+    </entity>
+    <entity name="Mail_Address" representedClassName="Mail_Address" syncable="YES">
+        <attribute name="address" attributeType="String" defaultValueString="&quot;&quot;"/>
+        <attribute name="invitations" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
+        <attribute name="primaryKeyID" optional="YES" attributeType="String"/>
+        <attribute name="pseudonym" attributeType="String"/>
+        <relationship name="account" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Account" inverseName="aliase" inverseEntity="Account"/>
+        <relationship name="bcc" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="PersistentMail" inverseName="bcc" inverseEntity="PersistentMail"/>
+        <relationship name="cc" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="PersistentMail" inverseName="cc" inverseEntity="PersistentMail"/>
+        <relationship name="contact" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="EnzevalosContact" inverseName="addresses" inverseEntity="EnzevalosContact"/>
+        <relationship name="from" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="PersistentMail" inverseName="from" inverseEntity="PersistentMail"/>
+        <relationship name="keys" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="PersistentKey" inverseName="mailaddress" inverseEntity="PersistentKey"/>
+        <relationship name="to" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="PersistentMail" inverseName="to" inverseEntity="PersistentMail"/>
+    </entity>
+    <entity name="PersistentKey" representedClassName="PersistentKey" syncable="YES">
+        <attribute name="autocryptGossip" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
+        <attribute name="discoveryDate" attributeType="Date" usesScalarValueType="NO"/>
+        <attribute name="encryptionType" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
+        <attribute name="gossip_timestamp" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
+        <attribute name="gotFailedCallForUse" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
+        <attribute name="isMisstrusted" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
+        <attribute name="isRepealed" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
+        <attribute name="keyID" attributeType="String"/>
+        <attribute name="lastSeen" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
+        <attribute name="lastSeenAutocrypt" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
+        <attribute name="origin" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
+        <attribute name="preferEncryption" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
+        <attribute name="pseudonym" attributeType="String"/>
+        <attribute name="sentOwnPublicKey" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
+        <attribute name="verifiedDate" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
+        <relationship name="activeKey" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="PersistentKey"/>
+        <relationship name="activeRepeal" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="PersistentMail"/>
+        <relationship name="childKeys" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="PersistentKey" inverseName="parentKey" inverseEntity="PersistentKey"/>
+        <relationship name="firstMail" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="PersistentMail" inverseName="attachedKeys" inverseEntity="PersistentMail"/>
+        <relationship name="mailaddress" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Mail_Address" inverseName="keys" inverseEntity="Mail_Address"/>
+        <relationship name="parentKey" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="PersistentKey" inverseName="childKeys" inverseEntity="PersistentKey"/>
+        <relationship name="record" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="KeyRecord" inverseName="key" inverseEntity="KeyRecord"/>
+        <relationship name="repealedByMails" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="PersistentMail" inverseName="repealsKey" inverseEntity="PersistentMail"/>
+        <relationship name="signedMails" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="PersistentMail" inverseName="signedKey" inverseEntity="PersistentMail"/>
+    </entity>
+    <entity name="PersistentMail" representedClassName="PersistentMail" syncable="YES">
+        <attribute name="attachedSignature" optional="YES" attributeType="Binary"/>
+        <attribute name="body" optional="YES" attributeType="String"/>
+        <attribute name="date" attributeType="Date" defaultDateTimeInterval="-31582140" usesScalarValueType="NO"/>
+        <attribute name="decryptedBody" optional="YES" attributeType="String"/>
+        <attribute name="decrytionCode" optional="YES" attributeType="String"/>
+        <attribute name="deleteWhileTravel" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
+        <attribute name="encryptedBody" optional="YES" attributeType="String"/>
+        <attribute name="flag" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
+        <attribute name="gmailMessageID" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
+        <attribute name="gmailThreadID" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
+        <attribute name="isCorrectlySigned" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
+        <attribute name="isEncrypted" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
+        <attribute name="isKeyImported" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
+        <attribute name="isSigned" attributeType="Boolean" usesScalarValueType="YES"/>
+        <attribute name="keyID" optional="YES" attributeType="String"/>
+        <attribute name="messageID" optional="YES" attributeType="String"/>
+        <attribute name="modSeqValue" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
+        <attribute name="notLoadedMessageIDs" optional="YES" attributeType="String"/>
+        <attribute name="received" attributeType="Boolean" defaultValueString="YES" usesScalarValueType="YES"/>
+        <attribute name="secretKey" optional="YES" attributeType="String"/>
+        <attribute name="storeEncrypted" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
+        <attribute name="subject" attributeType="String"/>
+        <attribute name="trouble" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
+        <attribute name="uid" attributeType="Decimal" defaultValueString="0"/>
+        <attribute name="uidvalidity" optional="YES" attributeType="Decimal" defaultValueString="0.0"/>
+        <attribute name="unableToDecrypt" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
+        <attribute name="visibleBody" optional="YES" attributeType="String"/>
+        <attribute name="xMailer" optional="YES" attributeType="String"/>
+        <relationship name="attachedKeys" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="PersistentKey" inverseName="firstMail" inverseEntity="PersistentKey"/>
+        <relationship name="attachments" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Attachment" inverseName="mail" inverseEntity="Attachment"/>
+        <relationship name="bcc" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Mail_Address" inverseName="bcc" inverseEntity="Mail_Address"/>
+        <relationship name="cc" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Mail_Address" inverseName="cc" inverseEntity="Mail_Address"/>
+        <relationship name="decryptedKey" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="SecretKey" inverseName="decryptedMails" inverseEntity="SecretKey"/>
+        <relationship name="folder" maxCount="1" deletionRule="Nullify" destinationEntity="Folder" inverseName="mails" inverseEntity="Folder"/>
+        <relationship name="from" maxCount="1" deletionRule="Nullify" destinationEntity="Mail_Address" inverseName="from" inverseEntity="Mail_Address"/>
+        <relationship name="record" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="KeyRecord" inverseName="persistentMails" inverseEntity="KeyRecord"/>
+        <relationship name="referenceMails" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="PersistentMail" inverseName="referenceMails" inverseEntity="PersistentMail"/>
+        <relationship name="relatedSecretKey" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="SecretKey" inverseName="relatedDecryptedMails" inverseEntity="SecretKey"/>
+        <relationship name="repealsKey" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="PersistentKey" inverseName="repealedByMails" inverseEntity="PersistentKey"/>
+        <relationship name="signedKey" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="PersistentKey" inverseName="signedMails" inverseEntity="PersistentKey"/>
+        <relationship name="to" toMany="YES" deletionRule="Nullify" destinationEntity="Mail_Address" inverseName="to" inverseEntity="Mail_Address"/>
+        <fetchIndex name="byDateIndex">
+            <fetchIndexElement property="date" type="Binary" order="ascending"/>
+        </fetchIndex>
+    </entity>
+    <entity name="SecretKey" representedClassName="SecretKey" syncable="YES">
+        <attribute name="exported" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
+        <attribute name="importedDate" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
+        <attribute name="keyID" attributeType="String" defaultValueString="no"/>
+        <attribute name="obsolete" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
+        <attribute name="origin" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
+        <relationship name="account" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Account" inverseName="keys" inverseEntity="Account"/>
+        <relationship name="decryptedMails" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="PersistentMail" inverseName="decryptedKey" inverseEntity="PersistentMail"/>
+        <relationship name="relatedDecryptedMails" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="PersistentMail" inverseName="relatedSecretKey" inverseEntity="PersistentMail"/>
+    </entity>
+    <entity name="Server" representedClassName="Server" syncable="YES" codeGenerationType="class">
+        <attribute name="authType" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
+        <attribute name="connectionType" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
+        <attribute name="hostname" attributeType="String"/>
+        <attribute name="port" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
+        <relationship name="imap" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Account" inverseName="imap" inverseEntity="Account"/>
+        <relationship name="smtp" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Account" inverseName="smtp" inverseEntity="Account"/>
+    </entity>
+    <fetchRequest name="allKeyRecords" entity="KeyRecord" predicateString="NOT (FALSEPREDICATE)" returnDistinctResults="YES"/>
+    <fetchRequest name="getFolder" entity="Folder" predicateString="name == &quot;$folder&quot;"/>
+    <fetchRequest name="getMailAddress" entity="Mail_Address" predicateString="address == &quot;$adr&quot;"/>
+    <elements>
+        <element name="Account" positionX="-315" positionY="-36" width="128" height="255"/>
+        <element name="Attachment" positionX="-315" positionY="-36" width="128" height="210"/>
+        <element name="EnzevalosContact" positionX="-209" positionY="198" width="128" height="120"/>
+        <element name="Folder" positionX="-297" positionY="-18" width="128" height="240"/>
+        <element name="KeyRecord" positionX="-315" positionY="-36" width="128" height="163"/>
+        <element name="Mail_Address" positionX="-297" positionY="-18" width="128" height="210"/>
+        <element name="PersistentKey" positionX="-315" positionY="-36" width="128" height="405"/>
+        <element name="PersistentMail" positionX="-416" positionY="-189" width="128" height="658"/>
+        <element name="SecretKey" positionX="-306" positionY="-27" width="128" height="163"/>
+        <element name="Server" positionX="-306" positionY="-27" width="128" height="135"/>
+    </elements>
+</model>
\ No newline at end of file