                         
                         // If there's an expiration date that's in the future, use that date as the purchase date.
                         if let fetchedExpirationDate = expirationDate {
+
                             if fetchedExpirationDate.timeIntervalSinceDate(purchaseDate) > 0 {
                                 purchaseDate = fetchedExpirationDate
                             }
+                            else
+                            {
+                               "The fetched expiry is in the past, keeping current date as starting point."
+                            }
+                        }
+                        else {
+                            print("Failed to fetch expiration date.")
                         }
                         
                         // Create a purchase

                return
            }
            
            let predicate : NSPredicate = NSPredicate(format: "\(self.keyUserWhoMadePurchase) == %@", userRecordName)
            let query : CKQuery = CKQuery(recordType: "Purchase", predicate: predicate)
            
            self.publicDatabase.performQuery(query, inZoneWithID: self.defaultRecordZone.zoneID, completionHandler: { (records : [CKRecord]?, error : NSError?) -> Void in

    
    func fetchPatronCountSince(date date: NSDate, withCompletionHandler completionHandler: (count : NSInteger?, error : NSError?) -> Void) {
        
        let predicate : NSPredicate = NSPredicate(format: "purchaseDate > %@ ", date)
        let query : CKQuery = CKQuery(recordType: "Purchase", predicate: predicate)
        
        self.publicDatabase.performQuery(query, inZoneWithID: self.defaultRecordZone.zoneID) { (records : [CKRecord]?, error : NSError?) -> Void in
            
            var userIDs : Set<String> = Set()
            
            if let records = records {
                
                for purchase : CKRecord in records {
                    if let userID = purchase[self.keyUserWhoMadePurchase] as? String {
                        userIDs.insert(userID)
                    }
                    else
