Updated convertToSequenceIndex procedure.