Cleaning and reviewing code for dynamic content

Overall revision of the code, with cleaning. Preparing to receive dynamic content, which means part of the code will come back as soon as the dynamic parts are corrected. Current errors are that .001 files should not have entries at XML Sources and .001 files at XML Regions should reference their original source at XML Sources.