Consolidate summary generation

Instead of looping through the changes a number of times to generate the summary this branch merges the functions into one.

QA: There are no visual changes in this branch, the summaries should be generated as before.