Reorder index code