refactor Table class