adding index code