Make the summary cleaning a separate function.

Change-Id: I26b6f7c6ad93273fb9837db70285b58afb40423c