moving index template to views and some cleanup.