             var currentState = currentState
             let str: String
             if _round(relative.x) == _round(point.x) {
-                if currentState == 1 {
-                    str = getPathDataString(nil, point.y)
-                } else {
-                    str = getPathDataString("V", point.y)
-                }
+                str = getPathDataString(currentState == 1 ? nil : "V", point.y)
                 currentState = 1
             } else if _round(relative.y) == _round(point.y) {
-                if currentState == 3 {
-                    str = getPathDataString(nil, point.x)
-                } else {
-                    str = getPathDataString("H", point.x)
-                }
+                str = getPathDataString(currentState == 3 ? nil : "H", point.x)
                 currentState = 3
             } else {
-                if currentState == 5 {
-                    str = getPathDataString(nil, point.x, point.y)
-                } else {
-                    str = getPathDataString("L", point.x, point.y)
-                }
+                str = getPathDataString(currentState == 5 ? nil : "L", point.x, point.y)
                 currentState = 5
             }
-            return (str, currentState, start, point, nil)
+            return (str, currentState, point, nil)
         case let .quad(p1, p2):
             
             var currentState = currentState
             let str: String
-            if isSmooth(p2, relative, lastControl) && 7...10 ~= currentState {
-                if currentState == 7 {
-                    str = getPathDataString(nil, p2.x, p2.y)
-                } else {
-                    str = getPathDataString("T", p2.x, p2.y)
-                }
+            if isSmooth(p1, relative, lastControl) && 7...10 ~= currentState {
+                str = getPathDataString(currentState == 7 ? nil : "T", p2.x, p2.y)
                 currentState = 7
             } else {
-                if currentState == 9 {
-                    str = getPathDataString(nil, p1.x, p1.y, p2.x, p2.y)
-                } else {
-                    str = getPathDataString("Q", p1.x, p1.y, p2.x, p2.y)
-                }
+                str = getPathDataString(currentState == 9 ? nil : "Q", p1.x, p1.y, p2.x, p2.y)
                 currentState = 9
             }
-            return (str, currentState, start, p2, p1)
+            return (str, currentState, p2, p1)
         case let .cubic(p1, p2, p3):
             
             var currentState = currentState
             let str: String
-            if isSmooth(p3, relative, lastControl) && 11...14 ~= currentState {
-                if currentState == 11 {
-                    str = getPathDataString(nil, p2.x, p2.y, p3.x, p3.y)
-                } else {
-                    str = getPathDataString("S", p2.x, p2.y, p3.x, p3.y)
-                }
+            if isSmooth(p1, relative, lastControl) && 11...14 ~= currentState {
+                str = getPathDataString(currentState == 11 ? nil : "S", p2.x, p2.y, p3.x, p3.y)
                 currentState = 11
             } else {
-                if currentState == 13 {
-                    str = getPathDataString(nil, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y)
-                } else {
-                    str = getPathDataString("C", p1.x, p1.y, p2.x, p2.y, p3.x, p3.y)
-                }
+                str = getPathDataString(currentState == 13 ? nil : "C", p1.x, p1.y, p2.x, p2.y, p3.x, p3.y)
                 currentState = 13
             }
-            return (str, currentState, start, p3, p2)
-        }
-    }
-    
-    func serialize2(_ currentState: Int, _ start: Point, _ relative: Point, _ lastControl: Point?) -> (String, Int, Point, Point, Point?) {
+            return (str, currentState, p3, p2)
+        }
+    }
+    
+    func serialize2(_ currentState: Int, _ relative: Point, _ lastControl: Point?) -> (String, Int, Point, Point?) {
         
         switch self {
         case let .line(point):

        }
        
        for item in self {
            item.serialize(&currentState, start: &start, relative: &relative, lastControl: &lastControl).write(to: &data)
        }
        
        if self.isClosed {

                } while g.next() != nil && !commandsymbol.contains(g.current.utf8.first!)
            case "T":
                repeat {
                    let p1 = lastbezier == 1 ? 2 * relative - lastcontrol : relative
                    let p2 = Point(x: try toDouble(g.current), y: try toDouble(g.next()))
                    relative = p2
                    lastcontrol = p1
