A method of preparing GaN material includes subjecting a GaN substrate to at least two cycles of Ga deposition and desorption, then applying a layer of AlN to the GaN substrate, then growing GaN on the AlN layer by molecular beam epitaxy. This results in reduced concentrations of oxygen, carbon, and silicon impurities.