added permutation option (not tested yet)