added SWAP function