A lot of code cleanup. Mostly remove unused "Use" statements. But also fixed a few bugs, and cleaned up unused variables.
Merge branch 'Code_Cleanup_foldor'