Clean and comment updateToc javascript code