refactor getTable