finally! (god that feels good)
Fixed the permutations function!