Updated convertToSequence procedure.