refactoring some factories for migration changes