added loops for index view