GetElementIndexInList logic modified