Minor refactor - uses enumerable#to_a instead of iterate and add to an array