convert tails to be a function of length