Adding a Permutation class

and updating TreePair to make use of it