Refactor some code into a utility module to help with the next report.