Added working function for integerswap