diff --git a/enzevalos_iphone.xcodeproj/project.pbxproj b/enzevalos_iphone.xcodeproj/project.pbxproj
index 8da5eb30f60e89ad6ded2064520b2d77c5dca471..59a6b5297526f957f331cf793acfd1c74b4d2381 100644
--- a/enzevalos_iphone.xcodeproj/project.pbxproj
+++ b/enzevalos_iphone.xcodeproj/project.pbxproj
@@ -13,8 +13,6 @@
 		472F392C1E1277D2009260FB /* PersistentMail +CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472F39281E1277D2009260FB /* PersistentMail +CoreDataClass.swift */; };
 		472F396E1E14F384009260FB /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 472F396D1E14F384009260FB /* CoreData.framework */; };
 		472F39701E14F75C009260FB /* DataHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472F396F1E14F75C009260FB /* DataHandler.swift */; };
-		472F39731E1D09C4009260FB /* State+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472F39711E1D09C4009260FB /* State+CoreDataClass.swift */; };
-		472F39741E1D09C4009260FB /* State+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472F39721E1D09C4009260FB /* State+CoreDataProperties.swift */; };
 		472F397C1E1D0B0B009260FB /* PersistentMail +CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472F39781E1D0B0B009260FB /* PersistentMail +CoreDataProperties.swift */; };
 		472F397E1E1D0B0B009260FB /* EnzevalosContact+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472F397A1E1D0B0B009260FB /* EnzevalosContact+CoreDataProperties.swift */; };
 		472F39811E1E5347009260FB /* Mail_Address+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472F397F1E1E5347009260FB /* Mail_Address+CoreDataClass.swift */; };
@@ -187,8 +185,6 @@
 		472F39281E1277D2009260FB /* PersistentMail +CoreDataClass.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "PersistentMail +CoreDataClass.swift"; path = "../PersistentMail +CoreDataClass.swift"; sourceTree = "<group>"; };
 		472F396D1E14F384009260FB /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
 		472F396F1E14F75C009260FB /* DataHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataHandler.swift; sourceTree = "<group>"; };
-		472F39711E1D09C4009260FB /* State+CoreDataClass.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "State+CoreDataClass.swift"; sourceTree = "<group>"; };
-		472F39721E1D09C4009260FB /* State+CoreDataProperties.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "State+CoreDataProperties.swift"; sourceTree = "<group>"; };
 		472F39781E1D0B0B009260FB /* PersistentMail +CoreDataProperties.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "PersistentMail +CoreDataProperties.swift"; sourceTree = "<group>"; };
 		472F397A1E1D0B0B009260FB /* EnzevalosContact+CoreDataProperties.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "EnzevalosContact+CoreDataProperties.swift"; sourceTree = "<group>"; };
 		472F397F1E1E5347009260FB /* Mail_Address+CoreDataClass.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Mail_Address+CoreDataClass.swift"; sourceTree = "<group>"; };
@@ -618,8 +614,6 @@
 				472F39781E1D0B0B009260FB /* PersistentMail +CoreDataProperties.swift */,
 				475DF4771F0D54C9009D807F /* Folder+CoreDataClass.swift */,
 				475DF4781F0D54C9009D807F /* Folder+CoreDataProperties.swift */,
-				472F39711E1D09C4009260FB /* State+CoreDataClass.swift */,
-				472F39721E1D09C4009260FB /* State+CoreDataProperties.swift */,
 				472F397A1E1D0B0B009260FB /* EnzevalosContact+CoreDataProperties.swift */,
 				472F39261E1277D2009260FB /* EnzevalosContact+CoreDataClass.swift */,
 				472F39801E1E5347009260FB /* Mail_Address+CoreDataProperties.swift */,
@@ -1286,7 +1280,6 @@
 				475B00051F7B953B006CDD41 /* PGPRSA.m in Sources */,
 				A1D5076F1E80257A00B68B38 /* KeyViewController.swift in Sources */,
 				472F39901E252470009260FB /* CNMailAddressesExtension.swift in Sources */,
-				472F39731E1D09C4009260FB /* State+CoreDataClass.swift in Sources */,
 				475B00261F7B953B006CDD41 /* PGPPartialKey.m in Sources */,
 				475B00251F7B953B006CDD41 /* PGPPacketFactory.m in Sources */,
 				475B002A1F7B953B006CDD41 /* PGPS2K.m in Sources */,
@@ -1301,7 +1294,6 @@
 				475B002D1F7B953B006CDD41 /* NSData+PGPUtils.m in Sources */,
 				475B000D1F7B953B006CDD41 /* PGPPublicKeyEncryptedSessionKeyPacket.m in Sources */,
 				A1083A541E8BFEA6003666B7 /* Onboarding.swift in Sources */,
-				472F39741E1D09C4009260FB /* State+CoreDataProperties.swift in Sources */,
 				A13526791D955BDF00D3BFE1 /* AppDelegate.swift in Sources */,
 				A1ECE54B1EFBE7ED0009349F /* FolderCell.swift in Sources */,
 				475DF4791F0D54C9009D807F /* Folder+CoreDataClass.swift in Sources */,
diff --git a/enzevalos_iphone/AppDelegate.swift b/enzevalos_iphone/AppDelegate.swift
index af3257e902b767ab9a3be85bd1145ec2a341570f..54d85344efc8c3433a4126f39eae78469cb7ee9f 100644
--- a/enzevalos_iphone/AppDelegate.swift
+++ b/enzevalos_iphone/AppDelegate.swift
@@ -85,7 +85,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
     func resetApp() {
         if UserDefaults.standard.bool(forKey: "reset") {
             if UserManager.loadUserValue(Attribute.userAddr) as! String == "ullimuelle@web.de" {
-                let mailhandler = MailHandler.init()
+                _ = MailHandler.init()
                 //mailhandler.move(mails: DataHandler.handler.findFolder(name: "INBOX").mailsOfFolder, from: "INBOX", to: "Archive")
             }
             DataHandler.handler.reset()
@@ -109,6 +109,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
         DispatchQueue.main.async(execute: {
             self.onboardingDone()
         });
+        let handler = DataHandler.init()
+        handler.createNewSecretKey(adr: UserManager.loadUserValue(Attribute.userAddr) as! String)
     }
 
     func onboardingDone() {
diff --git a/enzevalos_iphone/ContactViewController.swift b/enzevalos_iphone/ContactViewController.swift
index e90cc3fd3e3120cc5d7340ae4fe3c266b2951942..4f44aec69d7a71e9877c2a83ea0e1454dbc910e2 100644
--- a/enzevalos_iphone/ContactViewController.swift
+++ b/enzevalos_iphone/ContactViewController.swift
@@ -241,7 +241,7 @@ extension ContactViewController: UITableViewDataSource {
                 } else if indexPath.row == 1 {
                     if isUser && keyRecord!.hasKey {
                         let qrCodeCell = tableView.dequeueReusableCell(withIdentifier: "QRCodeCell", for: indexPath) as! QRCodeCell
-                        let qrCode = QRCode.generate(input: "OPENPGP4FPR:\(keyRecord?.fingerprint)")
+                        let qrCode = QRCode.generate(input: "OPENPGP4FPR:\(String(describing: keyRecord?.fingerprint))")
 
                         let scaleX = qrCodeCell.qrCode.frame.size.width / qrCode.extent.size.width
                         let scaleY = qrCodeCell.qrCode.frame.size.height / qrCode.extent.size.height
diff --git a/enzevalos_iphone/DataHandler.swift b/enzevalos_iphone/DataHandler.swift
index abb4c7e20086b5aa6bd23e9991e3900c272843e5..97082950befb7b3b961c4e8fb23466ecfc726fa5 100644
--- a/enzevalos_iphone/DataHandler.swift
+++ b/enzevalos_iphone/DataHandler.swift
@@ -107,16 +107,9 @@ class DataHandler {
         if mail.to.count == 0 && mail.cc == nil{
             print("Mail has no receiver: \(mail)")
         }
-        if mail.from == nil{
-            print("Mail has no sender: \(mail)")
-        }
-        if mail.folder == nil{
-            print("Mail has no folder: \(mail)")
-        }
     }
     
     func checkFolder(folderName: String){
-        print("#################")
         let folder = findFolder(with: folderName)
         if let mails = folder.mails{
             for m in mails{
@@ -127,7 +120,6 @@ class DataHandler {
         let records = folder.records
         checkRecords(records: records)
         checkRecords(records: folder.liveRecords)
-    print("Finish checking!")
     }
     
     
@@ -367,6 +359,16 @@ class DataHandler {
         return sk
     }
     
+    func createNewSecretKey(adr: String){
+        let keys = findSecretKeys()
+        if keys.count > 0{
+            return
+        }
+        let pgp = SwiftPGP()
+        let key = pgp.generateKey(adr: adr)
+        _ = DataHandler.handler.newSecretKey(keyID: key)
+    }
+    
     func newPublicKey(keyID: String, cryptoType: CryptoScheme, adr: String, autocrypt: Bool, firstMail: PersistentMail? = nil) -> PersistentKey{
         let date = Date.init() as NSDate
         let adr = getMailAddress(adr, temporary: false) as! Mail_Address
@@ -742,9 +744,6 @@ class DataHandler {
             if mail.uid > myfolder.maxID{
                 myfolder.maxID = mail.uid
             }
-            if mail.uid < myfolder.lastID || myfolder.lastID == 1{
-                myfolder.lastID = mail.uid
-            }
             save()
             return mail
         }
@@ -804,30 +803,4 @@ class DataHandler {
         let folder = findFolder(with: folderPath) as Folder
         return folder.records
     }
-
-
-    // Can we remove current state???
-        func getCurrentState() -> State {
-                let result = findAll("State")
-                if result != nil && result?.count > 0 {
-                    return (result?.first as? State)!
-                }
-                else {
-                    let currentstate = (NSEntityDescription.insertNewObject(forEntityName: "State", into: managedObjectContext) as? State)!
-                    if let set = findAll("EnzevalosContact"){
-                     currentstate.currentContacts = set.count
-                    }
-                    else{
-                        currentstate.currentContacts = 0
-                    }
-                    if let set = findAll("Mails"){
-                        currentstate.currentMails = set.count
-                    }
-                    else{
-                        currentstate.currentMails = 0
-                    }
-                    save()
-                    return currentstate
-                }
-            }
-        }
+}
diff --git a/enzevalos_iphone/DebugSettings.swift b/enzevalos_iphone/DebugSettings.swift
index bfe1953ea036ccc611aaa710a6344a9c914badb4..5d566c001a0461c5931c992e634d68457904d63b 100644
--- a/enzevalos_iphone/DebugSettings.swift
+++ b/enzevalos_iphone/DebugSettings.swift
@@ -48,7 +48,6 @@ func loadAlice2005(){
 private func userdefaults(defaults: [Attribute: AnyObject?]){
     for (att, value) in defaults{
         UserManager.storeUserValue(value, attribute: att)
-        print("Store: \(value) as \(att)")
     }
 
 }
diff --git a/enzevalos_iphone/Folder+CoreDataClass.swift b/enzevalos_iphone/Folder+CoreDataClass.swift
index 6051671390ff391959fe2d87018a89455a3036c5..df1b3e3f4950d94fee6f6083775659234f3f807d 100644
--- a/enzevalos_iphone/Folder+CoreDataClass.swift
+++ b/enzevalos_iphone/Folder+CoreDataClass.swift
@@ -40,12 +40,11 @@ public class Folder: NSManagedObject {
     
     var liveRecords: [KeyRecord]{
         get{
-            print("Calculate KeyRecords!")
             var records = [KeyRecord]()
             // Get all Keys, get all adrs
             let keys = DataHandler.handler.allKeysInFolder(folder: self)
             let adrs = DataHandler.handler.allAddressesInFolder(folder: self, withoutSecure: true)
-            
+           
             for key in keys{
                 let record = KeyRecord(keyID: key, folder: self)
                 records.append(record)
diff --git a/enzevalos_iphone/Folder+CoreDataProperties.swift b/enzevalos_iphone/Folder+CoreDataProperties.swift
index e409429afbb1efc95eb2d756ea4091e2a7b1fc85..a79c3b586d97e0747f956aad1ef14ae2a938a8ab 100644
--- a/enzevalos_iphone/Folder+CoreDataProperties.swift
+++ b/enzevalos_iphone/Folder+CoreDataProperties.swift
@@ -42,26 +42,6 @@ extension Folder {
         }
     }
     
-
-    
-    public var lastID: UInt64{
-        
-        set {
-            self.willChangeValue(forKey: "lastID")
-            self.setPrimitiveValue(NSDecimalNumber.init(value: newValue as UInt64), forKey: "lastID")
-            self.didChangeValue(forKey: "lastID")
-        }
-        get {
-            self.willAccessValue(forKey: "lastID")
-            let text = (self.primitiveValue(forKey: "lastID") as? NSDecimalNumber)?.uint64Value
-            self.didAccessValue(forKey: "lastID")
-            if text == nil{
-                return 1
-            }
-            return text!
-        }
-    }
-    
     public var maxID: UInt64{
         
         set {
diff --git a/enzevalos_iphone/FolderViewController.swift b/enzevalos_iphone/FolderViewController.swift
index b7ca402ab77ed579dd41e5b0d9bb705c41c159ab..988dacc87cc71a5d18772221ed26a150f396cfde 100644
--- a/enzevalos_iphone/FolderViewController.swift
+++ b/enzevalos_iphone/FolderViewController.swift
@@ -144,16 +144,11 @@ class FolderViewController: UITableViewController {
             performSegue(withIdentifier: "readFolderMailSegue", sender: getMails()[indexPath.row])
         }
         else {
-            if true {
-                let vc = storyboard?.instantiateViewController(withIdentifier: "folderViewController") as! FolderViewController
-                vc.folders = []
-                vc.isFirstFolderViewController = false
-                vc.presentedFolder = folders[indexPath.row]
-                self.navigationController?.pushViewController(vc, animated: true)
-            }
-            else {
-                performSegue(withIdentifier: "showFolderListSegue", sender: folders[indexPath.row])
-            }
+            let vc = storyboard?.instantiateViewController(withIdentifier: "folderViewController") as! FolderViewController
+            vc.folders = []
+            vc.isFirstFolderViewController = false
+            vc.presentedFolder = folders[indexPath.row]
+            self.navigationController?.pushViewController(vc, animated: true)
         }
     }
     override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
diff --git a/enzevalos_iphone/InboxViewController.swift b/enzevalos_iphone/InboxViewController.swift
index b05b8b8f481252fc8bc487e19308dfb16af6e60d..108d2c337c987f47946424a7f3f7e4b55e6189c7 100644
--- a/enzevalos_iphone/InboxViewController.swift
+++ b/enzevalos_iphone/InboxViewController.swift
@@ -68,11 +68,12 @@ class InboxViewController: UITableViewController, InboxCellDelegator {
         lastUpdateText = NSLocalizedString("Updating", comment: "Getting new data")
         let folder = DataHandler.handler.findFolder(with: UserManager.backendInboxFolderPath)
         AppDelegate.getAppDelegate().mailHandler.updateFolder(folder: folder, newMailCallback: addNewMail, completionCallback: getMailCompleted)
+       
     }
 
     func addNewMail() {
-        folder.updateRecords()
-        tableView.reloadData()
+        //folder.updateRecords()
+        //tableView.reloadData()
     }
 
     func getMailCompleted(_ error: Bool) {
@@ -80,7 +81,8 @@ class InboxViewController: UITableViewController, InboxCellDelegator {
             lastUpdate = Date()
             rc.endRefreshing()
             lastUpdateText = "\(NSLocalizedString("LastUpdate", comment: "When the last update occured")): \(dateFormatter.string(from: lastUpdate!))"
-
+            
+            folder.updateRecords()
             self.tableView.reloadData()
         }
     }
diff --git a/enzevalos_iphone/KeyViewController.swift b/enzevalos_iphone/KeyViewController.swift
index 8b8961d97e0776f6f2474c5e9d275e8b1d67211a..af1a67e3c4c468705e98fb47ef65ba95e3f5c360 100644
--- a/enzevalos_iphone/KeyViewController.swift
+++ b/enzevalos_iphone/KeyViewController.swift
@@ -63,7 +63,7 @@ extension KeyViewController: UITableViewDataSource {
             }
             else if toRowType(indexPath) == .encryptionType {
                 let cell = tableView.dequeueReusableCell(withIdentifier: "EncryptionTypeCell")!
-                cell.detailTextLabel?.text = "\(record?.cryptoscheme)"
+                cell.detailTextLabel?.text = "\(String(describing: record?.cryptoscheme))"
                 cell.textLabel?.text = NSLocalizedString("EncryptionType", comment: "Type of Encryption")
                 return cell
             }
diff --git a/enzevalos_iphone/MailHandler.swift b/enzevalos_iphone/MailHandler.swift
index 103680712c666500ef57986f9207b4f50169ccf7..2b31a23abcae934d12fcd0b62aba77254c218efd 100644
--- a/enzevalos_iphone/MailHandler.swift
+++ b/enzevalos_iphone/MailHandler.swift
@@ -811,7 +811,6 @@ class MailHandler {
         
         searchOperation?.start{(err, uids)-> Void in
             guard err == nil else{
-                print("Error while searching inbox: \(String(describing: err))")
                 completionCallback(true)
                 return
             }
diff --git a/enzevalos_iphone/ObjectivePGP/Packets/PGPSignatureSubpacket.m b/enzevalos_iphone/ObjectivePGP/Packets/PGPSignatureSubpacket.m
index 4482e4e5842dd17fcce056a1a8f2d99663835be8..840b37ae3e95e3ba4b6a81c1791d745fc15bed7a 100644
--- a/enzevalos_iphone/ObjectivePGP/Packets/PGPSignatureSubpacket.m
+++ b/enzevalos_iphone/ObjectivePGP/Packets/PGPSignatureSubpacket.m
@@ -54,7 +54,7 @@ NS_ASSUME_NONNULL_BEGIN
  *  @param packetBody A single subpacket body data.
  */
 - (void)parseSubpacketBody:(NSData *)packetBodyData {
-    PGPLogDebug(@"parseSubpacketBody %@, body %@",@(self.type), packetBodyData);
+    //PGPLogDebug(@"parseSubpacketBody %@, body %@",@(self.type), packetBodyData);
 
     switch (self.type & 0x7F) {
         case PGPSignatureSubpacketTypeSignatureCreationTime: // NSDate
@@ -213,7 +213,7 @@ NS_ASSUME_NONNULL_BEGIN
             if (self.type & 0x80) {
                 PGPLogError(@"Unsupported critical subpacket type %d", self.type);
             } else {
-                PGPLogDebug(@"Unsupported subpacket type %d", self.type);
+               // PGPLogDebug(@"Unsupported subpacket type %d", self.type);
             }
             break;
     }
@@ -345,7 +345,7 @@ NS_ASSUME_NONNULL_BEGIN
             if (self.type & 0x80) {
                 PGPLogError(@"Unsupported critical subpacket type %d", self.type);
             } else {
-                PGPLogDebug(@"Unsupported subpacket type %d", self.type);
+               // PGPLogDebug(@"Unsupported subpacket type %d", self.type);
             }
             break;
     }
diff --git a/enzevalos_iphone/Onboarding.swift b/enzevalos_iphone/Onboarding.swift
index e015ab4e3dabcbfd4f34737285bfdf238bf8ab94..cfa6ff7cacd0950b625a0bde9432efdc9cb56259 100644
--- a/enzevalos_iphone/Onboarding.swift
+++ b/enzevalos_iphone/Onboarding.swift
@@ -76,11 +76,9 @@ class Onboarding: NSObject {
         context = UIGraphicsGetCurrentContext()
         context!.setFillColor(ThemeManager.uncryptedMessageColor().cgColor)
         context!.fill(CGRect(x: 0, y: 0, width: myBounds.size.width, height: myBounds.size.height));
-        let snapshot2 = UIGraphicsGetImageFromCurrentImageContext();
         UIGraphicsEndImageContext();
 
         background = snapshot!
-        let postcardBg = snapshot2!
 
         //Introduction
         let intro0 = OnboardingContentViewController.content(withTitle: NSLocalizedString("Welcome", comment: "Welcome"), body: NSLocalizedString("ReadFollowingPages", comment: ""), image: nil, buttonText: nil, action: nil)
diff --git a/enzevalos_iphone/ReadViewController.swift b/enzevalos_iphone/ReadViewController.swift
index b0f3c7ba01bcdad3d573c1ef05a4007185031d68..e2e9473537c3a4b1cf376f39fbb2603193ae9e0a 100644
--- a/enzevalos_iphone/ReadViewController.swift
+++ b/enzevalos_iphone/ReadViewController.swift
@@ -90,7 +90,7 @@ class ReadViewController: UITableViewController {
         _ = mail?.from.contact?.records.flatMap { x in
             if x.hasKey && x.key != nil {
                 let keyWrapper = DataHandler.handler.findKey(keyID: x.key!)
-                keyDiscoveryDate = keyWrapper?.discoveryDate as! Date
+                keyDiscoveryDate = keyWrapper?.discoveryDate as Date?
             }
         }
     }
diff --git a/enzevalos_iphone/State+CoreDataClass.swift b/enzevalos_iphone/State+CoreDataClass.swift
deleted file mode 100644
index cfe2f941c23a6a8efe1781417b668505d6490fa5..0000000000000000000000000000000000000000
--- a/enzevalos_iphone/State+CoreDataClass.swift
+++ /dev/null
@@ -1,15 +0,0 @@
-//
-//  State+CoreDataClass.swift
-//  enzevalos_iphone
-//
-//  Created by Oliver Wiese on 04/01/17.
-//  Copyright © 2017 fu-berlin. All rights reserved.
-//
-
-import Foundation
-import CoreData
-
-@objc(State)
-open class State: NSManagedObject {
-    
-}
diff --git a/enzevalos_iphone/State+CoreDataProperties.swift b/enzevalos_iphone/State+CoreDataProperties.swift
deleted file mode 100644
index 228a9b89a66cb9bdc174cea1f7acd631acb63cc0..0000000000000000000000000000000000000000
--- a/enzevalos_iphone/State+CoreDataProperties.swift
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-//  State+CoreDataProperties.swift
-//  enzevalos_iphone
-//
-//  Created by Oliver Wiese on 04/01/17.
-//  Copyright © 2017 fu-berlin. All rights reserved.
-//
-
-import Foundation
-import CoreData
-
-
-extension State {
-
-    @nonobjc open override class func fetchRequest() -> NSFetchRequest<NSFetchRequestResult> {
-        return NSFetchRequest(entityName: "State");
-    }
-
-    public var currentMails: Int{
-        set {
-            let name = "currentMails"
-            self.willChangeValue(forKey: name)
-            self.setPrimitiveValue(newValue, forKey: name)
-            self.didChangeValue(forKey: name)
-        }
-        get {
-            let name = "currentMails"
-            self.willAccessValue(forKey: name)
-            let result = Int(self.primitiveValue(forKey: name) as! Int64)
-            self.didAccessValue(forKey: name)
-            return result
-        }
-    }
-    
-    public var currentContacts: Int{
-        set {
-            let name = "currentContacts"
-            self.willChangeValue(forKey: name)
-            self.setPrimitiveValue(newValue, forKey: name)
-            self.didChangeValue(forKey: name)
-        }
-        get {
-            let name = "currentContacts"
-            self.willAccessValue(forKey: name)
-            let result = Int(self.primitiveValue(forKey: name) as! Int64)
-            self.didAccessValue(forKey: name)
-            return result
-        }
-    }
-}
diff --git a/enzevalos_iphone/SwiftPGP.swift b/enzevalos_iphone/SwiftPGP.swift
index 93ff5691fa490f9656ce4ab4eafdc2f619460228..b63cac6ffb4536e9373dbb2d8c5246a21d224804 100644
--- a/enzevalos_iphone/SwiftPGP.swift
+++ b/enzevalos_iphone/SwiftPGP.swift
@@ -202,10 +202,6 @@ class SwiftPGP: Encryption{
         var plaintext: String? = nil
         if plaindata != nil{
             plaintext = plaindata?.base64EncodedString()
-            print("Plaintext: plaintext")
-        }
-        else{
-            print("No plaintext!")
         }
         return CryptoObject(chiphertext: data, plaintext: plaintext, decryptedData: plaindata, sigState: sigState, encState: encState, signKey: sigKey, encType: CryptoScheme.PGP)
     }
diff --git a/enzevalos_iphone/UserData.swift b/enzevalos_iphone/UserData.swift
index 1888ee685fc5b3b4fd131f1f667f42449ccebd96..4cd87df6dbb1d72d647b676e07830befb6c9408a 100644
--- a/enzevalos_iphone/UserData.swift
+++ b/enzevalos_iphone/UserData.swift
@@ -154,17 +154,5 @@ struct UserManager{
             //UserDefaults.standard.removeObject(forKey: "\(a.hashValue)")
         }
     }
-    
-    static func createKey(){
-        let keys =  DataHandler.handler.findSecretKeys()
-        if keys.count > 0{
-            return
-        }
-        let pgp = SwiftPGP()
-        if let adr = loadUserValue(Attribute.userAddr){
-            let key = pgp.generateKey(adr: adr as! String)
-            _ = DataHandler.handler.newSecretKey(keyID: key)
-        }
-    }
 }
 
diff --git a/enzevalos_iphone/enzevalos_iphone.xcdatamodeld/enzevalos_iphone 2.xcdatamodel/contents b/enzevalos_iphone/enzevalos_iphone.xcdatamodeld/enzevalos_iphone 2.xcdatamodel/contents
index 7e6fd288218ffbaa98ae43a0783302034ea9eb5b..b8c58f6029d4c6dc70bfe6fab176bcdad38ed2b0 100644
--- a/enzevalos_iphone/enzevalos_iphone.xcdatamodeld/enzevalos_iphone 2.xcdatamodel/contents	
+++ b/enzevalos_iphone/enzevalos_iphone.xcdatamodeld/enzevalos_iphone 2.xcdatamodel/contents	
@@ -3,10 +3,8 @@
     <entity name="Account" representedClassName="Account" syncable="YES" codeGenerationType="class">
         <attribute name="accountname" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="dispalyname" optional="YES" attributeType="String" syncable="YES"/>
-        <attribute name="pw" optional="YES" attributeType="String" syncable="YES"/>
+        <attribute name="provider" optional="YES" attributeType="String" syncable="YES"/>
         <relationship name="address" toMany="YES" deletionRule="Nullify" destinationEntity="Mail_Address" syncable="YES"/>
-        <relationship name="imap" maxCount="1" deletionRule="Nullify" destinationEntity="Server" syncable="YES"/>
-        <relationship name="smtp" maxCount="1" deletionRule="Nullify" destinationEntity="Server" syncable="YES"/>
     </entity>
     <entity name="EnzevalosContact" representedClassName="EnzevalosContact" syncable="YES">
         <attribute name="cnidentifier" optional="YES" attributeType="String" syncable="YES"/>
@@ -17,9 +15,7 @@
         <attribute name="delimiter" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="flags" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
         <attribute name="path" optional="YES" attributeType="String" syncable="YES"/>
-        <relationship name="lastID" maxCount="1" deletionRule="Nullify" destinationEntity="PersistentMail" syncable="YES"/>
         <relationship name="mails" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="PersistentMail" inverseName="folder" inverseEntity="PersistentMail" syncable="YES"/>
-        <relationship name="maxID" maxCount="1" deletionRule="Nullify" destinationEntity="PersistentMail" syncable="YES"/>
         <relationship name="parent" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Folder" inverseName="subfolder" inverseEntity="Folder" syncable="YES"/>
         <relationship name="subfolder" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Folder" inverseName="parent" inverseEntity="Folder" syncable="YES"/>
     </entity>
@@ -55,23 +51,11 @@
         <relationship name="from" maxCount="1" deletionRule="Nullify" destinationEntity="Mail_Address" inverseName="from" inverseEntity="Mail_Address" syncable="YES"/>
         <relationship name="to" toMany="YES" deletionRule="Nullify" destinationEntity="Mail_Address" inverseName="to" inverseEntity="Mail_Address" syncable="YES"/>
     </entity>
-    <entity name="Server" representedClassName="Server" syncable="YES" codeGenerationType="class">
-        <attribute name="authType" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
-        <attribute name="connectionType" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
-        <attribute name="hostname" optional="YES" attributeType="String" syncable="YES"/>
-        <attribute name="port" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
-    </entity>
-    <entity name="State" representedClassName="State" syncable="YES">
-        <attribute name="currentContacts" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
-        <attribute name="currentMails" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
-    </entity>
     <elements>
-        <element name="Account" positionX="-288" positionY="-9" width="128" height="135"/>
+        <element name="Account" positionX="-288" positionY="-9" width="128" height="105"/>
         <element name="EnzevalosContact" positionX="-209" positionY="198" width="128" height="90"/>
-        <element name="Folder" positionX="-297" positionY="-18" width="128" height="165"/>
+        <element name="Folder" positionX="-297" positionY="-18" width="128" height="135"/>
         <element name="Mail_Address" positionX="-297" positionY="-18" width="128" height="195"/>
         <element name="PersistentMail" positionX="-416" positionY="-189" width="128" height="315"/>
-        <element name="Server" positionX="-279" positionY="0" width="128" height="105"/>
-        <element name="State" positionX="-306" positionY="-27" width="128" height="75"/>
     </elements>
 </model>
\ No newline at end of file
diff --git a/enzevalos_iphone/enzevalos_iphone.xcdatamodeld/enzevalos_iphone.xcdatamodel/contents b/enzevalos_iphone/enzevalos_iphone.xcdatamodeld/enzevalos_iphone.xcdatamodel/contents
index 434ff284f877a8fea79f7e30176a642bae60afba..0a21eba0448e5b1254272e772ad3dc2b50e3b257 100644
--- a/enzevalos_iphone/enzevalos_iphone.xcdatamodeld/enzevalos_iphone.xcdatamodel/contents
+++ b/enzevalos_iphone/enzevalos_iphone.xcdatamodeld/enzevalos_iphone.xcdatamodel/contents
@@ -17,7 +17,6 @@
     <entity name="Folder" representedClassName="Folder" syncable="YES">
         <attribute name="delimiter" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="flags" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
-        <attribute name="lastID" optional="YES" attributeType="Decimal" defaultValueString="1" syncable="YES"/>
         <attribute name="lastUpdate" optional="YES" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
         <attribute name="maxID" optional="YES" attributeType="Decimal" defaultValueString="1" syncable="YES"/>
         <attribute name="path" attributeType="String" syncable="YES"/>
@@ -81,14 +80,14 @@
     <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="-288" positionY="-9" width="128" height="150"/>
         <element name="EnzevalosContact" positionX="-209" positionY="198" width="128" height="90"/>
-        <element name="Folder" positionX="-297" positionY="-18" width="128" height="165"/>
+        <element name="Folder" positionX="-297" positionY="-18" width="128" height="150"/>
         <element name="Mail_Address" positionX="-297" positionY="-18" width="128" height="150"/>
         <element name="PersistentKey" positionX="-315" positionY="-36" width="128" height="180"/>
         <element name="PersistentMail" positionX="-416" positionY="-189" width="128" height="315"/>
         <element name="SecretKey" positionX="-306" positionY="-27" width="128" height="75"/>
-        <element name="Server" positionX="-279" positionY="0" width="128" height="105"/>
-        <element name="State" positionX="-306" positionY="-27" width="128" height="75"/>
+        <element name="State" positionX="-315" positionY="-54" width="128" height="75"/>
+        <element name="Account" positionX="-306" positionY="-54" width="128" height="150"/>
+        <element name="Server" positionX="-297" positionY="-45" width="128" height="105"/>
     </elements>
 </model>
\ No newline at end of file