Actually write the index