Trying to use a sieve to speed up process