Significantly improved performance of permutation.