Split report() into handle_stats() and output_report() so that (1)