improve big-o of reporting period lateness algorithm