contract WMCToken is Owned, TokenERC20 {
    address public clearing;

    mapping (address => bool) public frozenAccount;

    // Triggered when account freeze status changes.
    event FrozenFunds(address target, bool frozen);

    // Triggered when tokens are burnt.
    event Burn(address indexed from, uint256 value);

    function WMCToken() TokenERC20(20000000, "Weekend Millionaires Club Token", "WMC") public {
        clearing = 0x0;
    }

    function freezeAccount(address _target, bool _freeze) onlyOwner public {
        require(_target != 0x0);

        frozenAccount[_target] = _freeze;
        FrozenFunds(_target, _freeze);
    }

    function transferClearingFunction(address _clearing) onlyOwner public {
        clearing = _clearing;
    }

    /**
     * Internal transfer, only can be called by this contract
     */
    function _transfer(address _from, address _to, uint _value) internal {
        require (clearing == 0x0 || clearing == _from || clearing == _to);

        require(!frozenAccount[_from]);
        require(!frozenAccount[_to]);

        super._transfer(_from, _to, _value);
    }

    /**
     * Destroy tokens
     *
     * Remove `_value` tokens from the system irreversibly
     *
     * @param _value the amount of money to burn
     */
    function burn(uint256 _value) onlyOwner public returns (bool success) {
        require(balanceOf[msg.sender] >= _value);

        balanceOf[msg.sender] -= _value;
        totalSupply -= _value;
        Burn(msg.sender, _value);
        return true;
    }

    /**
     * Destroy tokens from other account
     *
     * Remove `_value` tokens from the system irreversibly on behalf of `_from`.
     *
     * @param _from the address of the sender
     * @param _value the amount of money to burn
     */
    function burnFrom(address _from, uint256 _value) onlyOwner public returns (bool success) {
        require(balanceOf[_from] >= _value);
        require(_value <= allowance[_from][msg.sender]);

        balanceOf[_from] -= _value;
        allowance[_from][msg.sender] -= _value;
        totalSupply -= _value;
        Burn(_from, _value);
        return true;
    }
}
function _transfer(address _from, address _to, uint _value) internal {
        require (clearing == 0x0 || clearing == _from || clearing == _to);

        require(!frozenAccount[_from]);
        require(!frozenAccount[_to]);

        super._transfer(_from, _to, _value);
    }
/**
 * Internal transfer, only can be called by this contract
 */