It is used in the while loop above, so the copying needs to be done before that.