Table factory refactoring