Added save/restore state