simplify summarize and add pretty printing
fix summarize formatting