Added permute() method