tweaked and cleaned up code for gov-widget