Added views and changed index page to use view