#416 [Hugo/Remo] refactored common logic in custom_widget