Takes @mrognlie's changes verbatim, and integrates them into the report generation code. The report itself doesn't yet use the data.