Removes extraneous for loops from sieve function