     fullQuery = [select, from, where, orderBy, limit].join " "
     
     console.log "fullQuery: ", fullQuery
+    
     query = new Query 
       body: fullQuery
     
     query.run (err, rows) ->
-      console.log "rows: ", rows
       
-      formattedRows = applyColumnTemplates rows
+      formattedRows = applyColumnTemplates rows, activeColumns
       # ties logic, # records, second order calculations
       
-      # convert rows to latex
       tableText = toLatexTable
         data: rows
-        columns: columns
-        
-      console.log "tableText: ", tableText
+        columns: activeColumns
       
-      file = opts.outFilePath + report.file + ".tex"
+      file = opts.outfilePath + report.file + ".tex"
       
       # row outfile
       fs.writeFileSync file, tableText, "utf8"


fs            = require "fs"
moment        = require "moment"

Query         = require "../query"
toLatexTable  = require "../toLatexTable"

  }
]

applyColumnTemplates = (data, activeColumns) ->
  for column in activeColumns
    if column.template?
      for row in data
        row[column.property] = column.template row[column.property]
