Refactored array.rb