Removed duplication
Formatting
replace state with stateStr