contract ownerShip    // Auction Contract Owner and OwherShip change
{
    //Global storage declaration
    address payable public owner;

    address payable public newOwner;

    bool public safeGuard ; // To hault all non owner functions in case of imergency

    //Event defined for ownership transfered
    event OwnershipTransferredEv(address payable indexed previousOwner, address payable indexed newOwner);


    //Sets owner only on first run
    constructor() public 
    {
        //Set contract owner
        owner = msg.sender;
        // Disabled global hault on first deploy
        safeGuard = false;

    }

    //This will restrict function only for owner where attached
    modifier onlyOwner() 
    {
        require(msg.sender == owner);
        _;
    }


    function transferOwnership(address payable _newOwner) public onlyOwner 
    {
        newOwner = _newOwner;
    }


    //the reason for this flow is to protect owners from sending ownership to unintended address due to human error
    function acceptOwnership() public 
    {
        require(msg.sender == newOwner);
        emit OwnershipTransferredEv(owner, newOwner);
        owner = newOwner;
        newOwner = address(0);
    }

    function changesafeGuardStatus() onlyOwner public
    {
        if (safeGuard == false)
        {
            safeGuard = true;
        }
        else
        {
            safeGuard = false;    
        }
    }

}
// Owner Handler
function acceptOwnership() public 
{
    require(msg.sender == newOwner);
    emit OwnershipTransferredEv(owner, newOwner);
    owner = newOwner;
    newOwner = address(0);
}

//the reason for this flow is to protect owners from sending ownership to unintended address due to human error