Various cleanup steps and simplifications

I don't know if this will make merging things any easier, but it does simplify the code significantly. So even if I have to redo this after the merge of the core config change, hopefully it gives you an idea of where I want to go with things.