function transferOwnership(address newOwner) public onlyOwner { require(newOwner != 0); // Instead of swapping owner, we store the 'newOwner' address in the 'ownerTransf' variable. ownerTransf = newOwner; } // New functions // Cancel any on-going transfer. function cancelOwnershipTransfer() public onlyOwner { ownerTransf = 0; } // Lets the new owner claim ownership. function claimOwnership() public { require(msg.sender == ownerTransf); owner = ownerTransf; ownerTransf = 0; } }