begin refactoring to make testing and models easier.