Tables refactoring