made while loops more ruby-ish