easier to read version of sequence function