Savaged the easy part of the work on the decouple-logic-trees branch

There is some cleanup and some refactoring of the logic tree code that will come handy for the work about splitting the area sources.