table context refactoring