Excluding Owner and Burn Address in Max Wallet Amount _ ERC20 Token

Hey all!
I´m new to coding but have been working for endless hours trying to solve this issue on this ERC20 token. So far everything seems to work except for one thing that I just can´t seem to figure out. I know it is most likely a simple fix but it may be something I haven´t learned yet or am not seeing. Any thoughts on what can fix this?
Max Wallet amount.
The contract either executes the max wallet and not even the owner can receive more than the max wallet amount (this is causing problems for closing the liquidity pool on the Dex and receiving back the tokens put in) or
Max Wallet is not recognized and all accounts can have more than the amount indicated in the contract.
I figured it could be coded in the "_Transfer" function but maybe it needs a whole other working around to exclude the wallets. I tried everything. If... else statements, && !=, change the require statement. I tried putting in a function but probably made a mess of everything.
The mission is just to have a max wallet amount and exclude the burn address and the owner address (for if the owner changes). Having the max wallet works, but I can´t see how to exclude the burn and owner addresses. Again, to != owner() or msg.sender, etc. did not work, it was some code I read on a few sites, although there is not a lot on this subject out there.
Any help would be so appreciated.

The Code below:For Ease of read I didn´t put the library and contracts but it states what it is inheriting.

```Preformatted text`//SPDX-License-Identifier: MIT

pragma solidity 0.8.0;

contract ERC20 is Context, IERC20, Ownable, ReentrancyGuard {
using SafeMath for uint256;

mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;

uint BURN_RATE = 2;
uint private _totalSupply = 109 * 109;
uint8 public _decimals = 9;
string public _symbol = "E20";
string public _name = "ERC20";
uint _maxWltPer = 2;
uint256 private _maxWlt = (_totalSupply * _maxWltPer) / 100;


_balances[msg.sender] = _totalSupply;

emit Transfer(address(0), msg.sender, _totalSupply);


function getOwner() external view override returns (address) {return owner();}
function decimals() external view override returns (uint8) {return _decimals;}
function symbol() external view override returns (string memory) {return _symbol;}
function name() external view override returns (string memory) {return _name;}
function totalSupply() external view override returns (uint256) {return _totalSupply;}
function balanceOf(address account) public view override returns (uint256) {return _balances[account];}
function transfer(address to, uint256 amount) public override returns (bool) {

uint burnAmount = amount.mul(BURN_RATE) / 100;

_burn(_msgSender(), burnAmount);
_transfer(_msgSender(), to, amount.sub(burnAmount));

return true;

function allowance(address owner, address spender) external view override returns (uint256) {

  return _allowances[owner][spender];}

function approve(address spender, uint256 amount) external override returns (bool) {_approve(_msgSender(), spender, amount);return true;}
function transferFrom(address sender, address to, uint256 amount) external override returns (bool) {
_transfer(sender, to, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;


function burn(uint256 amount) public returns (bool) {
_burn(_msgSender(), amount);
return true;
function _transfer(address sender, address to, uint256 amount) internal{
require(sender != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (to == owner()) {
(balanceOf(msg.sender) >= _maxWlt);}

 require(balanceOf(to) + amount <= _maxWlt && to != address(msg.sender), "Transfer amount exceeds the maxWalletSize.");{

_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[to] = _balances[to].add(amount);
emit Transfer(sender, to, amount);

function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");

_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);

function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");

_allowances[owner][spender] = amount.add(_maxWlt);
emit Approval(owner, spender, amount);

function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));

}```Preformatted text`

I worked it out and found some code that rearranges the require check using an If structure.