Finished implementing state restoration.