tweak logic to index.rb