Big reorg around plugin architecture

Not completely testing, but should be working. Will deploy tomorrow and
get bug reports.
Couple of tweaks to the structure so that generated text is recorded
Slight reorg
Merge branch 'Massive-Refactor-for-Plugins'