refactoring of the widget ctor