I have the following definition of the Kodaira dimension of a smooth variety $X$: $$k(X):= \begin{cases} \max \dim \phi_{|nK_{X}|}(X) & \exists n:|nk|\neq \emptyset for \\ -\infty & \text{otherwise} \end{cases}$$

Where $\phi_{|nK_{X}|}$ is the map associated to the linear system $|nK_{X}|$ for $K_{X}$ the canonical divisor.

I also have the canonical ring defined as the graded $\mathbb{C}$ algebra $$R(X):= \bigoplus_{n\geq 0} H^{0}(X,nK_{X})$$

I would like to show that $\dim R(X)-1=k(X)$ when $k(X) \geq 0$.

My idea was to let $Q(D)=Frac{H^{0}(X,D)} \subseteq \mathbb{C}(X)$ for any divisor $D$. It's clear that $Q(D)=Q(D')$ whenever $D,D'$ are effective and linearly equivalent. Then choosing $D_{n} \in |nK_{X}|$ for every possible $n$ we can take $Q=\bigcup_{n \geq 0} Q(D_{n})$.

We can identify $R(X)$ with the subring $$\bigoplus_{n\geq 0} L(nK_{X})t^{n}\subseteq \mathbb{C}(V)(t)$$.

If we fix an $n$ we can take $f$ s.t $D=nK_{x} +(f)$. Then for any $m$ and any $g \in H^{0}(X, mK_{X})$ we have $D'=(g^{n})+nmK_{X} \sim mD$ and in fact $D'=mD+(g^{n}f^{-m})$ but $D'$ is effective so we have $g^{n}f^{-m}\in Q(mD)\subseteq Q$. Thus $gt^{m}$ is algebraic over $Q(ft^{n})$, so we must have $Frac(R(X))$ algebraic over $Q(ft^{n})$. In particular then $\dim (R(X))= Trdeg(Frac(R(X))=Trdeg(Q)+1$. We must have that Q is algebraic over $Q(D_{N})$ for some $N$ as $\mathbb{C}(X)$ has finite transcendence degree, thus $\dim R(X)= Trdeg(Q(D_{N})+1$.

I am pretty sure but not 100% certain that $Q(D_{n}) \cong \mathbb{C}( \phi_{|D_{n}|}(X))$

So we have $\dim R(X)-1=Trdeg(Q(D_{n}))=\dim \phi_{|D_{n}|}(X)+1$, which is very close to what I wanted to show, but sadly not quite right. Could someone point out where I went wrong and/or tell me if this is salvageable. A good reference for a different proof would also be welcome. I only actually need the result for surfaces if that has any impact at all.

Thanks.