Widget refactor

Misc widget code cleanup