Index: add functions to handle the data structure

Index is not just the index file