       type: token.string
       parameters: []
 
+
     while nextToken = pathTokens[i+1]
       if nextToken.type == NUMBER
         command.parameters.push(parseFloat(nextToken.string))

          params = params.slice(1)
        createNode([currentPoint[0], params[0]], i)

      when 'C', 'c', 'Q', 'q'
        # Bezier
        params = command.parameters
        params = makeAbsolute(params) if command.type in ['c', 'q']

        if command.type in ['C', 'c']
          currentPoint = slicePoint(params, 4)
          handleIn = slicePoint(params, 2)
          handleOut = slicePoint(params, 0)
        else
          currentPoint = slicePoint(params, 2)
          handleIn = handleOut = slicePoint(params, 0)

        lastNode = currentSubpath.nodes[currentSubpath.nodes.length - 1]
        lastNode.setAbsoluteHandleOut(handleOut)

        if node = createNode(currentPoint, i)
          node.setAbsoluteHandleIn(handleIn)
        else
          firstNode = currentSubpath.nodes[0]
          firstNode.setAbsoluteHandleIn(handleIn)

      when 'S', 's'
        # Shorthand cubic bezier.
        # Infer last node's handleOut to be a mirror of its handleIn.
        params = command.parameters
        params = makeAbsolute(params) if command.type == 's'

        currentPoint = slicePoint(params, 2)
        handleIn = slicePoint(params, 0)

        lastNode = currentSubpath.nodes[currentSubpath.nodes.length - 1]
        lastNode.join('handleIn')

        if node = createNode(currentPoint, i)
          node.setAbsoluteHandleIn(handleIn)
        else
          firstNode = currentSubpath.nodes[0]
          firstNode.setAbsoluteHandleIn(handleIn)

      when 'T', 't'
        # Shorthand quadradic bezier.
        # Infer node's handles based on previous node's handles
        params = command.parameters
        params = makeAbsolute(params) if command.type == 't'

        currentPoint = slicePoint(params, 0)

        lastNode = currentSubpath.nodes[currentSubpath.nodes.length - 1]
        lastNode.join('handleIn')

        # Use the handle out from the previous node.
        # TODO: Should check if the last node was a Q command...
        # https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#Bezier_Curves
        handleIn = lastNode.getAbsoluteHandleOut()

        if node = createNode(currentPoint, i)
          node.setAbsoluteHandleIn(handleIn)
        else
          firstNode = currentSubpath.nodes[0]
          firstNode.setAbsoluteHandleIn(handleIn)

      when 'Z', 'z'
        currentSubpath.closed = true


    node

  # When a command has more than one set of coords specified, we iterate over
  # each set of coords.
  #
  # Relative coordinates are relative to the last set of coordinates, not the
  # last command. (The SVG docs http://www.w3.org/TR/SVG/paths.html are not
  # super clear on this.)
  iterateOverParameterSets = (command, setSize, isRelative, callback) ->
    sets = command.parameters.length / setSize
    for setIndex in [0...sets]
      minindex = setIndex * setSize + 0
      maxIndex = setIndex * setSize + setSize
      paramSet = command.parameters.slice(minindex, maxIndex)
      paramSet = makeAbsolute(paramSet) if isRelative
      callback(paramSet, setIndex)
    return

  for i in [0...groupedCommands.length]
    command = groupedCommands[i]
    switch command.type
      when 'M', 'm'
        # Move to
        params = command.parameters
        params = makeAbsolute(params) if command.type == 'm'
        currentPoint = params
        addNewSubpath(currentPoint)

      when 'L', 'l'
