 
     fileprivate func prepareSvg(_ node: XMLIndexer) throws {
         if let element = node.element {
-            if element.name == "defs" {
-                try parseDefinitions(node)
-            } else if element.name == "style" {
+            if element.name == "style" {
                 parseStyle(node)
-            } else if element.name == "g" {
+            } else if (element.name == "defs" || element.name == "g") {
                 try node.children.forEach { child in
                     try prepareSvg(child)
+                }
+            }
+            if let id = element.allAttributes["id"]?.text {
+                switch element.name {
+                case "linearGradient", "radialGradient", "fill":
+                    defFills[id] = parseFill(node)
+                case "mask":
+                    defMasks[id] = try parseMask(node)
+                case "filter":
+                    defEffects[id] = try parseEffect(node)
+                case "clip":
+                    defClip[id] = try parseClip(node)
+                default:
+                    defNodes[id] = node
                 }
             }
         }

        guard let element = node.element else {
            return .none
        }
        let id = node.element?.allAttributes["id"]?.text
        let position = getPosition(element)
        switch element.name {
        case "path":

        }
    }

    fileprivate func parseElement(_ node: XMLIndexer, style: [String: String]) throws -> Node? {
        if style["visibility"] == "hidden" {
            return .none
