contract BinksBucksToken {
    /*
    This class implements the ERC20 Functionality for Binks Bucks
    along with other standard token helpers (e.g. Name, symbol, etc.).
    **/
    string public constant name = "Binks Bucks";
    string public constant symbol = "BINX";
    uint8 public constant decimals = 18;
    uint internal _totalSupply = 0;
    mapping(address => uint256) internal _balances;
    mapping(address => mapping (address => uint256)) _allowed;

    function totalSupply() public constant returns (uint) {
        /*
        Gets the total supply of Binks Bucks.
        **/
        return _totalSupply;
    }

    function balanceOf(address owner) public constant returns (uint) {
        /*
        Get the balance of an account.
        **/
        return _balances[owner];
    }

    // Helper Functions
    function hasAtLeast(address adr, uint amount) constant internal returns (bool) {
        if (amount <= 0) {return false;}
        return _balances[adr] >= amount;
    }

    function canRecieve(address adr, uint amount) constant internal returns (bool) {
        if (amount <= 0) {return false;}
        uint balance = _balances[adr];
        return (balance + amount > balance);
    }

    function hasAllowance(address proxy, address spender, uint amount) constant internal returns (bool) {
        if (amount <= 0) {return false;}
        return _allowed[spender][proxy] >= amount;
    }

    function canAdd(uint x, uint y) pure internal returns (bool) {
        uint total = x + y;
        if (total > x && total > y) {return true;}
        return false;
    }

    // End Helper Functions

    function transfer(address to, uint amount) public returns (bool) {
        /*
        Sends tokens to an address if you have the balance
        **/
        require(canRecieve(to, amount));
        require(hasAtLeast(msg.sender, amount));
        _balances[msg.sender] -= amount;
        _balances[to] += amount;
        Transfer(msg.sender, to, amount);
        return true;
    }

   function allowance(address proxy, address spender) public constant returns (uint) {
       /*
       Returns the amount which spender is still allowed to withdraw from
       proxy allowance.
       **/
        return _allowed[proxy][spender];
    }

    function approve(address spender, uint amount) public returns (bool) {
        /*
        Allows spender to withdraw from your account, multiple times,
        up to the _value amount. If this function is called again it
        overwrites the current allowance with _value
        **/
        _allowed[msg.sender][spender] = amount;
        Approval(msg.sender, spender, amount);
        return true;
    }

    function transferFrom(address from, address to, uint amount) public returns (bool) {
        /*
        Sends an amount of tokens from address an address if proxy allowance exists.
        **/
        require(hasAllowance(msg.sender, from, amount));
        require(canRecieve(to, amount));
        require(hasAtLeast(from, amount));
        _allowed[from][msg.sender] -= amount;
        _balances[from] -= amount;
        _balances[to] += amount;
        Transfer(from, to, amount);
        return true;
    }

    event Transfer(address indexed, address indexed, uint);
    event Approval(address indexed proxy, address indexed spender, uint amount);
}
function hasAtLeast(address adr, uint amount) constant internal returns (bool) {
    if (amount <= 0) {return false;}
    return _balances[adr] >= amount;
}

// Helper Functions