Doing some refactoring to get ready for unit test revamp.