 ## function recoverApp (callback)
 ## @callback {function} Continuation to pass control back to when complete.
 ## Callback all application names from database
-recoverApp = (callback) =>
+recoverApp = (callback) ->
     apps = []
-    db.view 'application/all', (err, res) =>
+    db.view 'application/all', (err, res) ->
         if err
             callback err
         else if not res
             callback null, []
         else
-            res.forEach (app) =>
+            res.forEach (app) ->
                 apps.push app.name
             callback null, apps
 

    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()

## @docs {tab} design docs with view
## @callback {function} Continuation to pass control back to when complete.
## Callback all design documents from database
recoverDocs = (res, docs, callback) ->
    if res and res.length isnt 0
        doc = res.pop()
        db.get doc.id, (err, result) ->
            docs.push(result)
            recoverDocs res, docs, callback
    else
