             }
         }
     }
+    
+    fileprivate func parseFirstPassNode(_ node: XMLIndexer, groupStyle: [String: String] = [:]) -> Node? {
+        if let element = node.element {
+            if element.name == "g" {
+                return parseGroup(node, groupStyle: groupStyle, firstPass: true)
+            } else if element.name == "defs" {
+                parseDefinitions(node)
+            }
+        }
+        return .none
+    }
 
     fileprivate func parseNode(_ node: XMLIndexer, groupStyle: [String: String] = [:]) -> Node? {
         if let element = node.element {
             if element.name == "g" {
-                return parseGroup(node, groupStyle: groupStyle)
+                return parseGroup(node, groupStyle: groupStyle, firstPass: false)
             } else if element.name == "clipPath" {
                 if let id = element.allAttributes["id"]?.text, let clip = parseClip(node) {
                     self.defClip[id] = clip
                 }
             } else if element.name == "style" {
                 parseStyle(node)
-            } else if element.name == "defs" {
-                parseDefinitions(node)
+            } else if element.name == "defs" { // keep the warning away
+                // do nothing - it was parsed on first iteration
             } else {
                 return parseElement(node, groupStyle: groupStyle)
             }

        }
    }

    fileprivate func parseGroup(_ group: XMLIndexer, groupStyle: [String: String] = [:]) -> Group? {
        guard let element = group.element else {
            return .none
        }

        let style = getStyleAttributes(groupStyle, element: element)
        let position = getPosition(element)
        group.children.forEach { child in
            if firstPass, let node = parseFirstPassNode(child, groupStyle: style) {
                groupNodes.append(node)
            }
            if !firstPass, let node = parseNode(child, groupStyle: style) {
                groupNodes.append(node)
            }
        }
