Fixed #1: Problem with the table of contents

Generating table of contents rewrited.