Fixing the harder TOC references, and including the Python script that does the work