use 'each_with_index' rather than @document_list.index(doc) to get index of object