contract TokenBase is ERC20Interface, Pausable, SafeMath {
    string public name;
    string public symbol;
    uint256 public decimals;
    uint256 internal _totalSupply;
    
    mapping(address => uint256) balances;
    mapping(address => mapping(address => uint256)) allowed;
    mapping (address => bool) public frozenAccount;

    event FrozenFunds(address target, bool frozen);
    event Burn(address indexed from, uint256 value);
    
    // ------------------------------------------------------------------------
    // Total supply
    // ------------------------------------------------------------------------
    function totalSupply() public constant returns (uint256) {
        return _totalSupply;
    }
    
    // ------------------------------------------------------------------------
    // Get the token balance for account `tokenOwner`
    // ------------------------------------------------------------------------
    function balanceOf(address tokenOwner) public constant returns (uint256 balance) {
        return balances[tokenOwner];
    }
    
    // ------------------------------------------------------------------------
    // Returns the amount of tokens approved by the owner that can be
    // transferred to the spender's account
    // ------------------------------------------------------------------------
    function allowance(address tokenOwner, address spender) public constant returns (uint256 remaining) {
        return allowed[tokenOwner][spender];
    }


    /**
     * Internal transfer, only can be called by this contract
     */
    function _transfer(address _from, address _to, uint256 _value) internal whenNotPaused returns (bool success) {
        require(_to != 0x0);                // Prevent transfer to 0x0 address. Use burn() instead
        require(balances[_from] >= _value);            // Check if the sender has enough
        require(!frozenAccount[_from]);                     // Check if sender is frozen
        require(!frozenAccount[_to]);                       // Check if recipient is frozen
        require( SafeMath.safeAdd(balances[_to], _value) > balances[_to]);          // Check for overflows
        uint256 previousBalances =  SafeMath.safeAdd(balances[_from], balances[_to]);
        balances[_from] = SafeMath.safeSub(balances[_from], _value);      // Subtract from the sender
        balances[_to] = SafeMath.safeAdd(balances[_to], _value);          // Add the same to the recipient
        assert(balances[_from] + balances[_to] == previousBalances);
        emit Transfer(_from, _to, _value);
        return true;
    }

    /**
     * Transfer tokens
     */
    function transfer(address _to, uint256 _value) public returns (bool success){
        _transfer(msg.sender, _to, _value);
        return true;
    }

    /**
     * Transfer tokens from other address
     */
    function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
        require(_value <= allowed[_from][msg.sender]);     // Check allowance
        allowed[_from][msg.sender] = SafeMath.safeSub(allowed[_from][msg.sender], _value);
        _transfer(_from, _to, _value);
        return true;
    }

    
    function approve(address spender, uint256 tokens) public whenNotPaused returns (bool success) {
        require(tokens >= 0);
        allowed[msg.sender][spender] = tokens;
        emit Approval(msg.sender, spender, tokens);
        return true;
    }

    function approveAndCall(address _spender, uint256 _value, bytes _extraData)
        public whenNotPaused returns (bool success) {
        tokenRecipient spender = tokenRecipient(_spender);
        if (approve(_spender, _value)) {
            spender.receiveApproval(msg.sender, _value, this, _extraData);
            return true;
        }
    }

    /**
     * Destroy tokens
     */
    
    function burn(uint256 _value) public onlyOwner whenNotPaused returns (bool success) {
		require(balances[msg.sender] >= _value);
		require(_value > 0);
        balances[msg.sender] = SafeMath.safeSub(balances[msg.sender], _value);            // Subtract from the sender
        _totalSupply = SafeMath.safeSub(_totalSupply, _value);                                // Updates totalSupply
        emit Burn(msg.sender, _value);
        return true;
    }

    /**
     * Destroy tokens from another account
     */
    function burnFrom(address _from, uint256 _value) public onlyOwner whenNotPaused returns (bool success) {
        require(balances[_from] >= _value);                // Check if the targeted balance is enough
        require(_value <= allowed[_from][msg.sender]);    // Check allowance
        balances[_from] = SafeMath.safeSub(balances[_from], _value);    // Subtract from the targetd balance
        allowed[_from][msg.sender] = SafeMath.safeSub(allowed[_from][msg.sender], _value);  // Subtract from the sender's allowance
        _totalSupply = SafeMath.safeSub(_totalSupply,_value);  
        emit Burn(_from, _value);
        return true;
    }
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
        require(_value <= allowed[_from][msg.sender]);     // Check allowance
        allowed[_from][msg.sender] = SafeMath.safeSub(allowed[_from][msg.sender], _value);
        _transfer(_from, _to, _value);
        return true;
    }
/**
 * Transfer tokens from other address
 */