added support for widgets and made stat widget
miscellaneous tidying