update maximumSequence method