Let  
 $\left( T,\,M \right)$  be a complete local (Noetherian) ring such that  
 $\dim\,T\,\ge \,2$  and  
 $\left| T \right|\,=\,\left| T/M \right|$  and let  
 ${{\left\{ {{p}_{i}} \right\}}_{i\in \Im }}$  be a collection of elements of  
 $T$  indexed by a set  
 $\mathcal{J}$  so that  
 $\left| \mathcal{J} \right|\,<\,\left| T \right|$ . For each  
 $i\,\in \,\mathcal{J}$ , let  
 ${{C}_{i}}:=\left\{ {{Q}_{i1}},...,{{Q}_{i{{n}_{i}}}} \right\}$  be a set of nonmaximal prime ideals containing  
 ${{p}_{i}}$  such that the  
 ${{Q}_{ij}}$  are incomparable and  
 ${{p}_{i}}\in {{Q}_{jk}}$  if and only if  
 $i\,=\,j$ . We provide necessary and sufficient conditions so that  
 $T$  is the  
 $\mathbf{m}$ -adic completion of a local unique factorization domain  
 $\left( A,\,\mathbf{m} \right)$ , and for each  
 $i\,\in \,\mathcal{J}$ , there exists a unit  
 ${{t}_{i}}$  of  
 $T$  so that  
 ${{p}_{i}}{{t}_{i}}\in A$  and  
 ${{C}_{i}}$  is the set of prime ideals  
 $Q$  of  
 $T$  that are maximal with respect to the condition that  
 $Q\cap A={{p}_{i}}{{t}_{i}}A$ .
We then use this result to construct a (nonexcellent) unique factorization domain containing many ideals for which tight closure and completion do not commute. As another application, we construct a unique factorization domain  
 $A$  most of whose formal fibers are geometrically regular.