Refactor/DRY table creation