move MOD and primes out