Minor improvement to PR: a and b do not need to be swapped since transpositions are involutions.