     putDirectory devicename, ".#{filePath}", false, (err, res) ->
 
         # Fetch only files with the same path/filename
-        db.db.query { map: (doc) ->
-
-            if doc.docType is 'File'
-                emit doc._id, doc
-
-        }, (err, res) ->
+        db.db.query { map: (doc) -> emit doc._id, doc if doc.docType is 'File' }, (err, res) ->
             for doc in res.rows
                 doc = doc.value
                 if doc.name is fileName and doc.path is filePath

    dirLastModification = stats.mtime

    # Lookup for existing directory
    db.db.query { map: (doc) ->

        if doc.docType is 'Folder'
            emit doc._id, doc

    }, (err, res) ->
        for doc in res.rows
            doc = doc.value
            if doc.path is dirPath and doc.name is dirName

mime = require 'mime'
process = require 'process'
uuid = require 'node-uuid'
async = require 'async'
log = require('printit')
    prefix: 'Data Proxy'

