use more idiomatic 'loop do'