table refactor