refactor sieve