                     return true;
                 }
                 """
-        # Usefull to manage device access
+        # Useful to manage device access
         device:
             all:
                 map: """

    initializeDSView ->
        if productionOrTest
            # Recover all applications in database
            recoverApp (err, apps) =>
                return callback err if err?
                # Recover all design docs in database
                recoverDesignDocs (err, docs) =>
                    return callback err if err?
                    async.forEach docs, (doc, cb) ->
                        async.forEach Object.keys(doc.views), (view, cb) ->
                            body = doc.views[view]
                            storeAppView apps, doc, view, body, cb
                        , (err) ->
                            removeEmptyView doc, (err) ->
                                log.error err if err?
                                cb()
                    , (err) ->
                        log.error err if err?
                        callback()

## function recoverDocs (callback)
## @callback {function} Continuation to pass control back to when complete.
## Callback all design documents from database
recoverDesignDocs = (callback) ->
    filterRange =
        startkey: "_design/"
        endkey: "_design0"
    db.all filterRange, (err, res) ->
        return callback err if err?
        recoverDocs res, [], callback


# Data system uses some views, this function initializes them.
initializeDSView = (callback) ->
    views =
        # Useful for function 'doctypes' (controller/request. Databrowser)
        doctypes:
            all:
                map: """
                function(doc) {
                    if(doc.docType) {
                        return emit(doc.docType.toLowerCase(), null);
                    }
                }
                """
