ruby refactors and sieve