Hmm actually it looks like this function operates on a single sequence and not all the sequences, so there is probably a better place to define the function and pattern for improving efficiency.