widget refactoring