Add save/load state support