Save and restore the user's code as well as allow reset.