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, "Only Owner allowed");
        _;
    }

    /**
    * @dev Allows the current owner to transfer control of the contract to a newOwner.
    * @param _newOwner The address to transfer ownership to.
    */
    function transferOwnership(address _newOwner) public onlyOwner {
        _transferOwnership(_newOwner);
    }

    /**
    * @dev Transfers control of the contract to a newOwner.
    * @param _newOwner The address to transfer ownership to.
    */
    function _transferOwnership(address _newOwner) internal {
        require(_newOwner != address(0), "Cannot transfer to 0 addresss");
        emit OwnershipTransferred(owner, _newOwner);
        owner = _newOwner;
    }

    
    function acceptOwnership() public {
        require(msg.sender == newOwner, "Sender not owner");
        emit OwnershipTransferred(owner, newOwner);
        owner = newOwner;
        newOwner = address(0);
    }
    

}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
function _transferOwnership(address _newOwner) internal {
    require(_newOwner != address(0), "Cannot transfer to 0 addresss");
    emit OwnershipTransferred(owner, _newOwner);
    owner = _newOwner;
}

/**
 * @dev Transfers control of the contract to a newOwner.
 * @param _newOwner The address to transfer ownership to.
 */