Modifying the code to use difflib and aggregate output