add functionality to main function for indexing