Re-factored code in index.scala.html