Genetic diversity in prokaryotes is primarily due to