Add ability to save and load state