further refactoring to start using the options class.
fixed up some tests