Code refactoring and removal of factory_widget attribute.