Changed the call order for the permutation routines to reflect the convention that output args come first