Add algorithm argument to suppor the new PERMUTE algorithm.