Nearly complete Create Index Func

Finish creating and sorting the invert table.