Properly build the index.