Added external state storage constructor

Added a constructor that takes the state accessor and state mutator, facilitating external state storage.