Localization of a UFD is again a UFD

Ilm been trying to do this problem for a while now.

Suppose our UFD is $\displaystyle R$ and we have the multiplicative set $\displaystyle W\subseteq R$.

The problem I'm having is that irreducible elements in one ring (either $\displaystyle R$ or $\displaystyle W^{-1}R$) don't seem to always carry over. As a simple example, consider the ring $\displaystyle \mathbb{Q}[x,y]$. Then $\displaystyle x$ is irreducible here, but is no longer irreducible in $\displaystyle \mathbb{Q}[x,y]_{(y)}$ (it becomes a unit). Conversely, the element $\displaystyle \frac{xy}{1}\in \mathbb{Q}[x,y]_{(y)}$ is irreducible (it is an associate of the irreducible element $\displaystyle \frac{y}{1}$). However, $\displaystyle xy$ is certainly not irreducible in $\displaystyle \mathbb{Q}[x,y]_{(y)}$.

So I'm basically stuck on BOTH conditions of having a UFD (showing there always EXISTS a factorization into irreducibles, and then proving that it is unique). Does anyone have any ideas?

EDIT: I believe I figured it out. A quick sketch of the steps I used:

1. Prove that if $\displaystyle r\in R$ is irreducible, then $\displaystyle r/1$ is either irreducible or a unit.

2. This means that a factorization of $\displaystyle r$ into irreducibles in $\displaystyle R$ will give a corresponding factorization of $\displaystyle r/1$ into irreducibles (and units). Since an arbitrary element of $\displaystyle W^{-1}R$ looks like $\displaystyle \frac{r}{w}=\frac{1}{w}\cdot \frac{r}{1}$, and $\displaystyle \frac{1}{w}\in W^{-1}R^*$, this implies that every nonzero nonunit of the localization has a factorization into irreducibles (existance).

3. Prove that if $\displaystyle r/w$ is irreducible, then $\displaystyle r/w$ is an associate of an element of the form $\displaystyle \frac{x^e}{1}$, where $\displaystyle x\in R$ is irreducible.

4. Use (3) to prove uniqueness, writing any irreducible in this form.

So, it works (I believe), but it's really just a lot of playing with elements and factorizations. I'm sure there's a better proof.