getSequenceMax refact