A genetic screen was developed for the identification of genes related to thiamin biosynthesis and degradation. Genes conferring resistance to bacimethrin or 4-amino-2-trifluoromethyl-5-hydroxymethylpyrimidine were selected from Escherichia coli and Bacillus subtilis genomic libraries. Hits from the selection included the known thiamin biosynthetic genes thiC, thiE, and dxs as well as five genes of previously unknown function (E. coli yjjX, yajO, ymfB, and cof and B. subtilis yveN). The gene products YmfB and Cof catalyze the hydrolysis of 4-amino-2-methyl-5-hydroxymethylpyrimidine pyrophosphate to 4-amino-2-methyl-5-hydroxymethylpyrimidine phosphate. YmfB also converts thiamin pyrophosphate into thiamin phosphate.