Automatic state recovery: Automatically recover the last state at the startup