Updated variable saving

Much better than original, as always.