Generalizes the function for transforming seqs.
Fixes up code.