allow the index to be choosen based on the element being indexed