Ammonia and alkyl halides react through alkylation of nitrogen via an SN2 mechanism to give monoalkylammonium salts, which on subsequent deprotonation give primary alkylamines. Alkylation makes the nitrogen center more nucleophilic, and successive alkylations repeat until all N–H protons are substituted with alkyl groups. This generates a complex mixture of amines with varying degrees of alkylation. For example, consider methylamine formed from the nucleophilic attack of ammonia on methyl halide, followed by deprotonation of nitrogen from the generated monomethylammonium salt. Methylamine attacks another molecule of methyl iodide to give dimethylammonium salt, and deprotonation of the salt produces dimethylamine. Further alkylation produces trimethylamine, and finally, the quaternary ammonium salt, and the process stops. The overall reaction—going from ammonia to the quaternary ammonium salt—is called exhaustive alkylation. The direct alkylation method is less efficient as it produces polyalkylated products. Nevertheless, good yields of quaternary ammonium salts can be obtained through exhaustive alkylation, while primary amines can be successfully synthesized using a large excess of ammonia.