             self.proj = nil
         }
 
-        // Projects and targets
+        // Projects, targets, groups and file references.
+        // Note: The references of those type of objects should be generated first.
+        ///      We use them to generate the references of the objects that depend on them.
+        ///      For instance, the reference of a build file, is generated from the reference of
+        ///      the file it refers to.
         let identifiers = [String(describing: project), project.name]
         generateProjectAndTargets(project: project, identifiers: identifiers)
-
-        // Groups
         if let mainGroup: PBXGroup = try? project.mainGroupReference.object() {
             try generateGroupReferences(mainGroup, identifiers: identifiers)
         }

        }
    }

    func generateProjectAndTargets(project: PBXProject,
                                   identifiers: [String]) {
        if project.reference.temporary {
            project.reference.fix(generate(identifiers: identifiers))
        }

        let targets: [PBXTarget] = project.targetsReferences.compactMap({ try? $0.object() as PBXTarget })

        // Targets
        targets.forEach { target in

            var identifiers = identifiers

        if let name = buildRule.name {
            identifiers.append(name)
        }

        // Build rule
        if buildRule.reference.temporary {
            buildRule.reference.fix(generate(identifiers: identifiers))
        }
