refactor widgettype code
merge