using index from the input files