Add flexibility to toc tree and fix small issues