added dynamic functionality to index.html.erb