use implicit loop to refactor the index view