refactor index.rb