Rational maps from noetherian $k$-scheme to projective $k$-scheme extend over regular codimension 1 sets I am trying to solve and am currently stuck on Vakil's problem 16.5.B which is asked as follows:

Suppose $X$ is a Noetherian $k$-scheme and $Z$ is a irreducible
  codimesion $1$ subvariety whose generic point is a regular point of
  $X$. Suppose $\pi:X\dashrightarrow Y$ is a rational map to a
  projective $k$-scheme, show that the domain of definition of the
  rational map induces a dense open subset of $Z$.

My thoughts are that the solution should follow the proof of the theorem 16.5.1 curve-to-projective theorem, but I run into technical difficuties. First I assume that $Y$ is a projective scheme $\mathbb{P}^{n}$. Then I need to proof that the rational map contains a class $[U,f]$ where $U$ contains that generic point of $Z$. So I start with any class $[V,g]$ where we assume that $V$ does not contain the generic point $\eta$ of $Z$. We want to extend $V$ so that it cotains $\eta$.
Usual argument applies to show that there exists a uniformizer $t$ in the local ring $\mathcal{O}_{X,\eta}$. The morphism $g: V\rightarrow Y$ is determined by line bundle $L$ and its sections $f_0$,...,$f_n$ with no base point.
Question Can I multiply powers of $t$ to the $f_i$'s to extend the function over to the generic point?
The obstacle I am facing here is that that there is no reason I can do that. I can't selectively choose my $V$ either. How should I solve this problem or is there another solution?
 A: Here's a sketch: You may assume $X$ integral with generic point $\xi$. Then, restricting the given rational map to $\text{Spec}({\mathscr O}_{X,\xi})=\text{Spec}(k(X))$ yields a $k(X)$-valued point of ${\mathbb P}^n_k$, represented by $(s_0,...,s_n)\in k(X)^n\setminus 0$, say. Next, note that since $Z$ is regular of codimension $1$ in $X$, it induces a discrete valuation $v_Z$ on $k(X)$; let $\pi$ be a uniformizer, i.e. $v_Z(\pi)=1$. Then, putting $k := \min\{v_Z(s_i)\ |\ i=0,1,...,n\}$ and replacing $(s_0,...,s_n)$ by $(s_0 \pi^{-k},...,s_n\pi^{-k})$, we may assume that $v_Z(s_i)\geq 0$ for all $i$, with equality for at least one $i$. Then you can check that $(s_0,...,s_n)$ defines a rational map to $X\dashrightarrow{\mathbb P}^n$ defined on an open subset of $X$ containing the generic point of $Z$. Moreover, on a dense subset of the domain of definition, this morphism factors through $Y\subseteq{\mathbb P}^n$, hence it does so on its whole domain of definition, since $X$ is reduced.
Let me know if you need further details.
Some requested details: If $X$ is integral with generic point $\xi$, and $U\subseteq X$ is non-empty and open, then any morphism $f: U\to {\mathbb P}^n_k$ induces a morphism $f_\eta: \text{Spec}({\mathscr O}_{X,\eta})=\text{Spec}(k(X))\to{\mathbb P}_k^n$ by restriction. If $V\subseteq X$ is another non-empty open set and $g: V\to {\mathbb P}_k^n$ is a morphism with $g_\eta = f_\eta$, then $f=g$ on $U\cap V$: Indeed, the incidence locus of $f|_{U\cap V}, g|_{U\cap V}: U\cap V\to {\mathbb P}_k^n$ is a closed subscheme (${\mathbb P}_k^n$ is separated) containing $\xi$, hence its underlying topological space is the whole of $U\cap V$; since $U\cap V$ is reduced, it indeed follows that $f|_{U\cap V}=g|_{U\cap V}$. This shows that sending $f$ to $f_\xi$ defines an injective map of sets 
$$(\ast)\quad \lim\limits_{\emptyset\neq U\subseteq X} \text{Mor}_k(U,{\mathbb P}_k^n)\longrightarrow \text{Mor}_k(\text{Spec}(k(X)),{\mathbb P}_k^n)=\left[k(X)^n\setminus\{0\}\right] /\ k(X)^{\times}.$$
This map is even surjective: If $(s_0,...,s_n)\in k(X)^n\setminus\{0\}$, then there exists $\emptyset\neq U\subseteq X$ such that $s_0,...,s_n\in{\mathscr O}_X(U)$, with $\langle s_0,...,s_n\rangle = {\mathscr O}_X(U)$ (note that for integral schemes $X$,  one has a canonical embedding ${\mathscr O}_X(U)\subseteq k(X)$). For example, picking any $s_{i_0}\neq 0$, one might take $U$ such that all $s_i\in{\mathscr O}_X(U)$ and $s_{i_0}\in{\mathscr O}_X(U)^{\times}$ (just pick $U$ so small that also $s_{i_0}^{-1}\in{\mathscr O}_X(U)$). For $U$ chosen as above, the $s_i$ then define a morphism $U\to{\mathbb P}_k^n$ mapping to $[s_0,...,s_n]$ under $(\ast)$. 
Coming back to the original construction, we have seen that given a rational map $X\dashrightarrow {\mathbb P}_k^n$ its associated element of $\left[k(X)^n\setminus\{0\}\right]/\ k(X)^{\times}$ can be represented by some $(s_0,...,s_n)$ with $v_Z(s_i)\geq 0$ for all $i$, and with equality for at least one $i$. This means that $s_i\in {\mathscr O}_{X,\eta}$ for all $i$, where $\eta$ is the generic point of $Z$, with $s_i\in{\mathscr O}_{X,\eta}^{\times}$ for at least one $i$. Then we may choose a small enough neighbourhood $V$ of $\eta$ such that $s_i\in{\mathscr O}_X(V)$ for all $i$ and $s_i\in{\mathscr O}_X(V)^{\times}$ for at least one $i$, and we have seen that this defines a map $f: V\to {\mathbb P}_k^n$ also mapping to $[s_0:\ldots:s_n]$ under $(\ast)$. By injectivity of $(\ast)$, $f$ coincides with given rational map $X\dashrightarrow {\mathbb P}_k^n$ on some nonzero open set (in fact, their common domain of definition, as we have seen).
Finally, as above, the so constructed map $f: V\to {\mathbb P}_k^n$ also factors through $Y$ since it does so on a (dense) open subset, and $V$ is reduced.
