fixing shared and unshared primes, and adding tests