made the inner loop in sieve() more efficient