Sort summary and add TOC