Add ability to retrieve initial state.
Tidy up.