Step 3: Save and load state