a little refactoring on the way to making a pluggable architecture.