Refactor some code
extract summary formatter