contract Owned {
    address public owner;
    address public newOwner;
    event OwnershipTransferred(address indexed _from, address indexed _to);

    constructor() public {
        owner = msg.sender;
    }
    modifier onlyOwner {
        require(msg.sender == owner);
        _;
    }

    //Transfer owner rights, can use only owner (the best practice of secure for the contracts)
    function transferOwnership(address _newOwner) public onlyOwner {
        newOwner = _newOwner;
    }

    //Accept tranfer owner rights
    function acceptOwnership() public onlyOwner {
        emit OwnershipTransferred(owner, newOwner);
        owner = newOwner;
        newOwner = address(0);
    }
}
// Owned contract
function transferOwnership(address _newOwner) public onlyOwner {
    newOwner = _newOwner;
}

//Transfer owner rights, can use only owner (the best practice of secure for the contracts)