Refactor reporting to avoid much of the code duplication