Moved the widget state load/dump code to a separate file. Also added