           fileRef = @currentFile
       else
         fileRef = false
-    else
-      search = {}
-      search["versions.#{version}.path"] = "#{@storagePath}/#{http.params.file}"
-      @currentFile = @collection.findOne(search)
-      if @currentFile
-        fileRef = @currentFile.versions[version]
-
-    unless _.isObject(fileRef) and fs.existsSync fileRef.path
-      console.warn "Meteor.Files Debugger: [download(#{http}, #{version})] [404] File not found: #{fileRef.path}" if @debug
-      text = "File Not Found :("
-      http.response.writeHead 404,
-        'Content-Length': text.length
-        'Content-Type':   "text/plain"
-      http.response.end text
-      return undefined
-
+
+    if @public
+      fileRef =
+        path: "#{@storagePath}/#{http.params.file}"
+      responseType = if fs.existsSync fileRef.path then '200' else '404'
+    else if not fileRef or not _.isObject(fileRef) or not fs.existsSync fileRef.path
+      responseType = '404'
     else if @currentFile
       partiral   = false
       reqRange   = false
       fileStats  = fs.statSync fileRef.path
 
-
-      if fileStats.size isnt fileRef.size and not @integrityCheck
-        fileRef.size = fileStats.size
-      else if fileStats.size isnt fileRef.size and @integrityCheck
-        console.warn "Meteor.Files Debugger: [download(#{http}, #{version})] [400] Content-Length mismatch!: #{fileRef.path}" if @debug
-        text = "Content-Length mismatch!"
-        http.response.writeHead 400,
-          'Cache-Control': 'no-cache'
-          'Content-Length': text.length
-          'Content-Type':   "text/plain"
-        http.response.end text
-        return undefined
+      fileRef.size = fileStats.size if fileStats.size isnt fileRef.size and not @integrityCheck
+      responseType = '400' if fileStats.size isnt fileRef.size and @integrityCheck
 
       if http.params.query.download and http.params.query.download == 'true'
         dispositionType = 'attachment; '

          reqRange.start = start
          reqRange.end   = start + take

        if (@strict and not http.request.headers.range) or reqRange.start >= fileRef.size or reqRange.end > fileRef.size
          console.info "Meteor.Files Debugger: [download(#{http}, #{version})] [416] Content-Range is not specified!: #{fileRef.path}" if @debug
          http.response.writeHead 416,
            'Content-Range':        "bytes */#{fileRef.size}"
            'Pragma':               'public'
            'Expires':              -1
            'Cache-Control':        'public, must-revalidate, post-check=0, pre-check=0'
            'Accept-Ranges':        'bytes'
          http.response.end()
          return undefined
        else
          console.info "Meteor.Files Debugger: [download(#{http}, #{version})] [206]: #{fileRef.path}" if @debug
          
          console.log "[206]", {start: reqRange.start, end: reqRange.end}
          stream = fs.createReadStream fileRef.path, {start: reqRange.start, end: reqRange.end}
          http.response.writeHead 206, 
            'Content-Range':        "bytes #{reqRange.start}-#{reqRange.end}/#{fileRef.size}"
            'Cache-Control':        'no-cache'
            'Content-Type':         fileRef.type
            'Content-Encoding':     'binary'
            'Content-Disposition':  "attachment; filename=\"#{encodeURI(@currentFile.name)}\"; charset=utf-8"
            'Content-Length':       if reqRange.start == reqRange.end then 0 else (reqRange.end - reqRange.start + 1);
            'Accept-Ranges':        'bytes'
          stream.pipe http.response

      else
        console.info "Meteor.Files Debugger: [download(#{http}, #{version})] [200]: #{fileRef.path}" if @debug
        stream = fs.createReadStream fileRef.path
        http.response.writeHead 200, 
          'Content-Range':        "bytes 0-#{fileRef.size}/#{fileRef.size}"
          'Cache-Control':        cacheControl
          'Content-Type':         fileRef.type
          'Content-Disposition':  disposition
          'Content-Length':       fileRef.size
          'Accept-Ranges':        'bytes'
        stream.on 'open', ->
          stream.pipe http.response
        return undefined
  else
    undefined



      dispositionName     = "filename=\"#{encodeURI(@currentFile.name)}\"; "
      dispositionEncoding = 'charset=utf-8'

      http.response.setHeader 'Content-Type', fileRef.type
      http.response.setHeader 'Content-Disposition', dispositionType + dispositionName + dispositionEncoding
      http.response.setHeader 'Cache-Control', if (http.params.query.play and http.params.query.play == 'true') then 'public, must-revalidate, post-check=0, pre-check=0' else @cacheControl
      http.response.setHeader 'Accept-Ranges', 'bytes'

      if http.request.headers.range
        partiral = true
