An epitaxial layer can be doped during deposition by adding impurities to the source gas, such as arsine, phosphine, or diborane. Dopants in the source gas, liberated by evaporation or wet etching of the surface, may also diffuse into the epitaxial layer and cause autodoping. The concentration of impurity in the gas phase determines its concentration in the deposited film. Doping can also be achieved by a site-competition technique, where the growth precursor ratios are tuned to enhance the incorporation of vacancies, specific dopant species or vacant-dopant clusters into the lattice.  Additionally, the high temperatures at which epitaxy is performed may allow dopants to diffuse into the growing layer from other layers in the wafer (out-diffusion).