added makeIndex function. NOT TESTED YET!