changed prime_gen slightly