refactoring this to be more like a factory