     undefined # not returning the comprehension
 
 
+  # Exporting Methods
+  # ------------------------------------------------------
+
+  # TODO: This method only works for small objects with less then ~196614 verts. I don't know why.
+  # TODO: determine if this bug was solved with the uint16 indices fix
+  exportTextStl: ->
+    str = "solid P3D\n"
+    formatFloat = (flt, i)-> (if sign(flt) >= 0 or i == 0 then " " else "") + flt.toExponential(6)
+    formatVector = (array, v) -> (formatFloat(array[i], if v then i else 1) for i in [0..2]).join(" ")
+
+    @_eachFace (f, i) ->
+      str += "  facet normal #{ formatVector f.normals[0], false }\n"
+      str += "    outer loop\n"
+      str += "      vertex #{ formatVector v, true }\n" for v in f.vertices
+      str += "    endloop\n"
+      str += "  endfacet\n"
+
+    str += "endsolid P3D"
+    str = str.replace(/e\+([0-9][^0-9])/g, "e+0$1")
+    str = str.replace(/e\-([0-9][^0-9])/g, "e-0$1")
+    return new Blob [str], type: "application/octet-stream"
+
+
   # Mesh Manipulation Methods (File API/AJAX and Parser agnostic)
   # ---------------------------------------------------------------
+
+  # Scales the mesh by the scale option's value (either a number or an array of per-axis numbers)
+  _applyScaling: -> if @scale?
+    scale = @scale
+    scale = (scale for i in [0..2]) if typeof(scale) == "number"
+
+    for i in [0..2]
+      for j in [0..@vertices.length] by 3
+        @vertices[i+j] = @vertices[i+j] * scale[i]
 
   # iterates over all the faces of the mesh
   _eachFace: (fn) =>

  #  opts: (optional) a object containing properties for this parser
  #     background: (boolean) if true this parser will spawn a webworker and run outside the UI thread
  #  callback: the fn to run once the 3d geometry has been parsed
  constructor: (@src, @opts) ->
    args = arguments
    @opts = {background: true} if args.length < 3 or !( @opts? )
    @callback = args[args.length-1]

    # Determining the file name and the file type
    @filename = if typeof(@src) == "string" then @src.split("/").pop().replace("/", "") else @src.name
    @fileType = capitalize fileExt(@filename).toLowerCase()

    if @_fileTypeWhitelist.indexOf(@fileType) == -1

    @[attr] = exp[attr] for attr in ['vertices', 'normals']
    @verts = @vertices


  # Blob Loading
  # ------------------------------------------------------

  _initReader: (type) ->
    @dataType = type if type?
    r = @reader = new FileReader()
    r.onload = @_onReaderLoad
    r["readAs#{type}"] @blob

  _binaryStlCheck: (text) ->
    @fileType == "Stl" and @dataType == "Text" and text[0..80].match(/^solid /) == null

  _onReaderLoad: () =>
    data = @reader.result
    delete @reader
    # If the STL file turns out not to be a text file then reread it as an array buffer
    return @_initReader("ArrayBuffer") if @_binaryStlCheck(data)
    # Parsing the data
    @["_parse#{@dataType}#{@fileType}"] data
    @_executePipeline()
    @callback @


  # Parsing Methods (File API/AJAX agnostic)
  # ------------------------------------------------------

  # TODO: inflate the zip file here
  _parseTextAmf: (text) ->
    xml = parseXml text
    root = xml.documentElement
