refactoring as a widget (component)