refactoring index template