refactored primes code - slightly more efficient(?) + readable now