Completed save/restore functions.