better permutation indexing