         var outLength : Int = 0
         let theIV = inData.subdataWithRange(NSMakeRange(inData.length-kCCBlockSizeAES128, kCCBlockSizeAES128))
         let theCipherText = inData.subdataWithRange(NSMakeRange(0, inData.length-kCCBlockSizeAES128))
-        let theClearText = NSMutableData(length: inData.length + kCCBlockSizeAES128)
+        guard let theClearText = NSMutableData(length: inData.length + kCCBlockSizeAES128) else { return nil }
         let theOperation : CCOperation = UInt32(kCCDecrypt)
         let theAlgorithm :  CCAlgorithm = UInt32(kCCAlgorithmAES128)
         let theOptions :   CCOptions = UInt32(kCCOptionPKCS7Padding)

        print(theHash)
        print(theSalt)
        print(theKey)
        let theCipherText = encryptData(theSecret.dataUsingEncoding(NSUTF8StringEncoding)!, inKey: theKey, inIV: randomDataWithLength(kCCBlockSizeAES128))
        // uncomment for CommonCrypto mega fail
//        let theCipherText = encryptData(theSecret.dataUsingEncoding(NSUTF8StringEncoding)!, inKey: theSecret.dataUsingEncoding(NSUTF8StringEncoding)!, inIV: randomDataWithLength(kCCBlockSizeAES128))
        print((theCipherText))
        let theClearData = decryptData(theCipherText!, inKey: theKey)!
        let theClearText = NSString(data: theClearData, encoding: NSUTF8StringEncoding)
        print(theClearText)
        
        storeSecretInKeychain(thePassword.dataUsingEncoding(NSUTF8StringEncoding)!, inAccount: "MyAccount", inLabel: "MyLabel", inService: "MyService")
        let theRestoredSecret = secretFromKeychain("MyAccount")!
        print(NSString(data: theRestoredSecret, encoding: NSUTF8StringEncoding))
        

        let theFileManager = NSFileManager.defaultManager()
        let theLocalDirectories = theFileManager.URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)
        
        guard let theDocumentsPath = theLocalDirectories.first else { fatalError() }
        let theFileURL = theDocumentsPath.URLByAppendingPathComponent("foobar.txt")
        
        let theContentString = "foobar"
        let theContentData = theContentString.dataUsingEncoding(NSUTF8StringEncoding)
        
        let theAttributes = [NSFileProtectionKey : NSFileProtectionComplete]
        guard let theFilePath = theFileURL.path else { fatalError() }
        theFileManager.createFileAtPath(theFilePath, contents:theContentData, attributes:theAttributes)
        
        // Backup exclusion
        do {
            try theFileURL.setResourceValue(true, forKey: NSURLIsExcludedFromBackupKey)
        } catch {
            print("Error: \(error)")
            print("Backup exclusion not set")
        }
        
