wrote sieve functions