updated permutation class and tests