refactor to use upto
refactor to use implicit returns
refactor to use implicit return and Array#map
refactor to use Enumerable#find_all