added swapPos to switch elements at 2 positions in a list