Add State struct, state wrapper around api