introduced widgetWindow class to reduce redundancy