     return createWordReport(filename, data)
 
 # ANIMAL BIOASSAY REPORT -------------------------------------------------------
-animalWordReport = (tbl_id, filename) ->
-
-    getData = () ->
-        tbl = Tables.findOne(tbl_id)
-        studies = AnimalEvidence
-            .find({tbl_id: tbl_id}, {sort: {sortIdx: 1}})
-            .fetch()
-
-        for study in studies
-            study.reference = Reference.findOne(_id: study.referenceID)
-            share.setAnimalWordFields(study)
-
-        d =
-            "monographAgent": tbl.monographAgent
-            "volumeNumber": tbl.volumeNumber
-            "hasTable": true
-            "table": tbl
-            "studies": studies
-
-        return d
-
-    data = getData()
-    path = share.getWordTemplatePath(filename)
-    docx = new DocxGen().loadFromFile(path, {async: false, parser: angularParser})
-    docx.setTags(data)
-    docx.applyTags()
-    docx.output({type: "string"})
-
+animalWordReport = (tbl_id) ->
+    tbl = Tables.findOne(tbl_id)
+    studies = AnimalEvidence
+        .find({tbl_id: tbl_id}, {sort: {sortIdx: 1}})
+        .fetch()
+
+    for study in studies
+        study.reference = Reference.findOne(_id: study.referenceID)
+        share.setAnimalWordFields(study)
+
+    d =
+        "monographAgent": tbl.monographAgent
+        "volumeNumber": tbl.volumeNumber
+        "hasTable": true
+        "table": tbl
+        "studies": studies
+
+    return d
 
 # MECHANISTIC REPORT -----------------------------------------------------------
-mechanisticWordReport = (tbl_id, filename) ->
+mechanisticWordReport = (tbl_id) ->
 
     getReferences = (obj) ->
         refs = Reference.find({_id: {$in: obj.references}}).fetch()

    expr = angular_expressions.compile(tag)
    return get: expr

# EXPOSURE REPORT -------------------------------------------------------
exposureWordReport = (tbl_id, filename) ->

    getData = () ->
        tbl = Tables.findOne(tbl_id)
        occupationals = ExposureEvidence
            .find({
                    tbl_id: tbl_id,
                    exposureScenario: "Occupational"
                  }, {sort: {sortIdx: 1}})
            .fetch()
        environmentals = ExposureEvidence
            .find({
                    tbl_id: tbl_id,
                    exposureScenario: "Environmental"
                  }, {sort: {sortIdx: 1}})
            .fetch()

        for study in occupationals
            study.reference = Reference.findOne(_id: study.referenceID)
            share.setExposureWordFields(study)

        for study in environmentals
            study.reference = Reference.findOne(_id: study.referenceID)
            share.setExposureWordFields(study)

        d =
            "monographAgent": tbl.monographAgent
            "volumeNumber": tbl.volumeNumber
            "hasTable": true
            "table": tbl
            "occupationals": occupationals
            "environmentals": environmentals

        return d

    data = getData()
    path = share.getWordTemplatePath(filename)
    docx = new DocxGen().loadFromFile(path, {async: false, parser: angularParser})
    docx.setTags(data)
    docx.applyTags()
    docx.output({type: "string"})


# EPI REPORTS ------------------------------------------------------------------

    docx.applyTags()
    return docx.output({type: "string"})

epiWordReport = (tbl_id, epiSortOrder) ->
    switch epiSortOrder
        when "Reference"
            return getEpiDataByReference(tbl_id)
        when "Organ-site"
            return getEpiDataByOrganSite(tbl_id)
        else
            console.error("unknown epiSortOrder")

epiWordReportMultiTable = (filename, monographAgent, volumeNumber) ->
    epiSortOrder = ReportTemplate.findOne({filename: filename}).epiSortOrder
