tables refactoring