Modified MO index rootine to generate a TOC index using etree