Replace "viewsize" with "viewWidth" and "viewHeight"
Replace "statesize" with "stateWidth" and "stateHeight"