Final version for inverted index