Start of refactoring to use factories