Added simple implementation of load/save state.