refactor amazon.rb