Some more code improvements in widgets