refactoring to handle widget in table