Fix of repeating code in widgets
Same fix in window