changed index  to be template