adding non-recursive permute