xor caused trouble, involving a dumb 3rd var for swapping