         }
     }
     
-    
     @IBAction func savePassword(sender: UIButton) {
+        // The ACL configuration for a Keychain Item.
+        // The 1st param specifies what allocator to use (the default is typically used).
+        // The 2nd param specifies what type of protection...
+        //   kSecAttrAccessibleWhenUnlocked only allows the retrieval of the Keychain Item
+        //   when the device is unlocked.
+        // The 3rd param is a flag that causes the Touch ID / Passcode challenge to execute.
+        // The 4th param is used to pass in the address of an Error object.
         let secAC = SecAccessControlCreateWithFlags(kCFAllocatorDefault,kSecAttrAccessibleWhenUnlocked, .UserPresence, nil)
-        
+        // Convert the secret from String to NSData
         let passwordData: NSData = passwordField.text!.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)!
         
+        // A dictionary of attributes to describe our Keychain Item(s).
         let attrs : [NSObject : AnyObject] = [
             kSecClass: kSecClassGenericPassword,
             kSecAttrService : "IntertechSecure",
             kSecAttrAccount : "Instructor",
             kSecValueData : passwordData,
-            kSecAttrAccessControl : secAC!,
-            kSecUseOperationPrompt : "Touch ID Demo"
+            kSecAttrAccessControl : secAC!, // The ACL created above
+            kSecUseOperationPrompt : "Touch ID Demo" // Message to be displayed to user
 
         ]
         
+        // TODO: A best practice is to update an existing Keychain item,
+        // rather than delete -> add.  Rewrite to follow this pattern.
         SecItemDelete(attrs)
-        let resultCode = SecItemAdd(attrs as CFDictionaryRef, nil)
+        let resultCode = SecItemAdd(attrs, nil)
         if resultCode != errSecSuccess {
             print("Unable to Add Password to Keychain.  Error Code: \(resultCode)")
         } else {

            kSecAttrService : "IntertechSecure",
            kSecAttrAccount : "Instructor"
        ]
        
        SecItemDelete(attrs)
    }
    
    func retrievePassword() -> String? {
        let attrs : [NSObject:AnyObject] = [
            kSecClass : kSecClassGenericPassword,
            kSecAttrService : "IntertechSecure",
            kSecAttrAccount : "Instructor",
            kSecReturnData : kCFBooleanTrue
        ]
        var passwordData:AnyObject?
        SecItemCopyMatching(attrs, &passwordData)
        let password = String(data: (passwordData as? NSData) ?? NSData(), encoding: NSUTF8StringEncoding)
        return password
    }

//  (if the user has either enabled)

import UIKit
// The SecItem API requires the Security framework
// (don't forget to add this in the Target -> General -> Linked Frameworks & Libraries)
import Security

// A Keychain Item with ACL flags.  Requires the user to use Touch ID / Passcode.
class TouchIDAuthViewController: UIViewController {
    @IBOutlet weak var passwordField: UITextField!
    @IBOutlet weak var keychainField: UITextField!

    @IBAction func loadPassword(sender: UIButton) {
        if let password = retrievePassword() {
