Localization of a UFD is again a UFD

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

Suppose our UFD is and we have the multiplicative set .

The problem I'm having is that irreducible elements in one ring (either or ) don't seem to always carry over. As a simple example, consider the ring . Then is irreducible here, but is no longer irreducible in (it becomes a unit). Conversely, the element is irreducible (it is an associate of the irreducible element ). However, is certainly not irreducible in .

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 is irreducible, then is either irreducible or a unit.

2. This means that a factorization of into irreducibles in will give a corresponding factorization of into irreducibles (and units). Since an arbitrary element of looks like , and , this implies that every nonzero nonunit of the localization has a factorization into irreducibles (existance).

3. Prove that if is irreducible, then is an associate of an element of the form , where 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.