contract BLAccess {

    address public mainAddress; //Main Contract Address
    address public bonusAddress; //BonusAddress
    event UpdatedMainAccount(address _newMainAddress);
    event UpdatedBonusAccount(address _newBonusAddress);

    function BLAccess() public {
        mainAddress = msg.sender;
        bonusAddress = msg.sender;
    }

    modifier onlyPrimary() {
        require(msg.sender == mainAddress);
        _;
    }

    modifier onlyBonus() {
      require(msg.sender == bonusAddress);
      _;
    }

    function setSecondary(address _newSecondary) external onlyPrimary {
      require(_newSecondary != address(0));
      bonusAddress = _newSecondary;
      UpdatedBonusAccount(_newSecondary);
    }

    //Allows to change the primary account for the contract
    function setPrimaryAccount(address _newMainAddress) external onlyPrimary {
        require(_newMainAddress != address(0));
        mainAddress = _newMainAddress;
        UpdatedMainAccount(_newMainAddress);
    }

}
/*
 Manages ownership and permissions for the whole contract.
 */
function setPrimaryAccount(address _newMainAddress) external onlyPrimary {
    require(_newMainAddress != address(0));
    mainAddress = _newMainAddress;
    UpdatedMainAccount(_newMainAddress);
}

//Allows to change the primary account for the contract