adding an index to output