savegame: moving remaining local variables into functions