3rd pass at state API with overloaded state() function

Use overloaded state() function to set and get state.

Added new config options for setting a whole new state object.