Consolidate option handling, add initial test infrastructure.

The consolidation may have broken some things, I'm not sure. I'm going 
to continue to add tests.