         let fields = try container.nestedContainer(keyedBy: GenericCodingKeys.self, forKey: .fields)
         
         let fieldMapping = unboxing()
-        
         let requiredFields = fieldMapping.filter{ $0.value.1 == true }
         let requiredKeys  = Set(requiredFields.keys)
+        
+        print ("required keys: \(requiredKeys)")
+        
+        
         let fieldsReturned = Set(fields.allKeys.map { $0.stringValue })
-        guard requiredKeys.isSubset(of: fieldsReturned) else { throw DecodingError.missingRequiredFields(Array( requiredKeys.subtracting(fieldsReturned)))}
+        
+        print ("fieldsReturned: \(fieldsReturned)")
+        
+        print ("is subset: \(requiredKeys.isSubset(of: fieldsReturned))")
+        
+        guard requiredKeys.isSubset(of: fieldsReturned) else { throw DecodingError.missingRequiredFields(Array(requiredKeys.subtracting(fieldsReturned)))}
         
         for key in fields.allKeys {
             let field = key.stringValue
-         
-          
             
             if let (type, required) = fieldMapping[field] {
                 do {

        object = creator(fields)
    }
    
  
    static func unboxableFields(fromDecoder decoder: Decoder, withUnboxing unboxing: (() -> FieldMapping)) throws -> UnboxedFields {
       
        func getValueFromDict<T>(dict: [String:T], locale: Locale?) -> T? {
            if let locale = locale {
                return dict[locale.favouredLocale.rawValue] ?? dict[locale.fallbackLocale.rawValue]

                    }
                    
                } catch {
                    throw DecodingError.typeMismatch(String.self)
                }
            }
