     
     private class func setupKeychainQueryDictionaryForKey(keyName: String) -> NSMutableDictionary {
         // Setup dictionary to access keychain and specify we are using a generic password (rather than a certificate, internet password, etc)
-        var keychainQueryDictionary: NSMutableDictionary = [kSecClass:kSecClassGenericPassword]
+        let SecClass: String! = kSecClass as String
+        var keychainQueryDictionary: NSMutableDictionary = [SecClass:kSecClassGenericPassword]
         
         // Uniquely identify this keychain accessor
-        keychainQueryDictionary[kSecAttrService] = KeychainWrapper.serviceName
-
+        let SecAttrService: String! = kSecAttrService as String
+        keychainQueryDictionary[SecAttrService] = KeychainWrapper.serviceName
+        
         // Uniquely identify the account who will be accessing the keychain
         var encodedIdentifier: NSData? = keyName.dataUsingEncoding(NSUTF8StringEncoding)
-            
-        keychainQueryDictionary[kSecAttrGeneric] = encodedIdentifier
-        keychainQueryDictionary[kSecAttrAccount] = encodedIdentifier
+        
+        let SecAttrGeneric: String! = kSecAttrGeneric as String
+        keychainQueryDictionary[SecAttrGeneric] = encodedIdentifier
+        
+        let SecAttrAccount: String! = kSecAttrAccount as String
+        keychainQueryDictionary[SecAttrAccount] = encodedIdentifier
         
         return keychainQueryDictionary
     }

        var keychainQueryDictionary = self.setupKeychainQueryDictionaryForKey(keyName)
        
        // Limit search results to one
        keychainQueryDictionary[kSecMatchLimit] = kSecMatchLimitOne
        
        // Specify we want NSData/CFData returned
        keychainQueryDictionary[kSecReturnData] = kCFBooleanTrue
        
        // Search
        var searchResultRef: Unmanaged<AnyObject>?

    
    class func setObject(value: NSCoding, forKey keyName: String) -> Bool {
        let data = NSKeyedArchiver.archivedDataWithRootObject(value)
        
        return self.setData(data, forKey: keyName)
    }
    
    class func setData(value: NSData, forKey keyName: String) -> Bool {
        var keychainQueryDictionary: NSMutableDictionary = self.setupKeychainQueryDictionaryForKey(keyName)
        
        let SecValueData: String! = kSecValueData as String
        keychainQueryDictionary[SecValueData] = value
        
        // Protect the keychain entry so it's only valid when the device is unlocked
        let SecAttrAccessible: String! = kSecAttrAccessible as String
        keychainQueryDictionary[SecAttrAccessible] = kSecAttrAccessibleWhenUnlocked
        
        let status: OSStatus = SecItemAdd(keychainQueryDictionary, nil)
        
        let SecSuccess: Int! = Int(errSecSuccess)
        let SecDuplicateItem: Int! = Int(errSecDuplicateItem)
        if Int(status) == SecSuccess {
            return true
        } else if Int(status) == SecDuplicateItem {
            return self.updateData(value, forKey: keyName)
        } else {
            return false
        }
    }
    
    // MARK: Removing Values
    class func removeObjectForKey(keyName: String) -> Bool {
        let keychainQueryDictionary: NSMutableDictionary = self.setupKeychainQueryDictionaryForKey(keyName)
        
        // Delete
        let status: OSStatus =  SecItemDelete(keychainQueryDictionary);
        
        let SecSuccess: Int! = Int(errSecSuccess)
        if Int(status) == SecSuccess {
            return true
        } else {
            return false
        }
    }
    
    // MARK: Private Methods
    private class func updateData(value: NSData, forKey keyName: String) -> Bool {
        let keychainQueryDictionary: NSMutableDictionary = self.setupKeychainQueryDictionaryForKey(keyName)
        let SecValueData: String! = kSecValueData as String
        let updateDictionary = [SecValueData:value]
        
        // Update
        let status: OSStatus = SecItemUpdate(keychainQueryDictionary, updateDictionary)
        
        let SecSuccess: Int! = Int(errSecSuccess)
        if Int(status) == SecSuccess {
            return true
        } else {
            return false
