Move the state table functions into the state.go file. [ci skip]
Minor comment fixes. [ci skip]