Refactor sieve eratosthenes