Finish setup code for state

the framework for the setup is now filled with finished working code