Updated report generation code