Cleaned some redundent code in statewidget