Working save/restore!

Only tested in v3, but the v5 logic is nearly identical, store instead
of branch.