Cleaned up and commented permutations solution.