Inlined swapping and made a/x/y global.