Added loop through shifts for permutation