contract Moderated {

    address public moderator;

    bool public unrestricted;

    modifier onlyModerator {
        require(msg.sender == moderator);
        _;
    }

    modifier ifUnrestricted {
        require(unrestricted);
        _;
    }

    modifier onlyPayloadSize(uint numWords) {
        assert(msg.data.length >= numWords * 32 + 4);
        _;
    }

    function Moderated() public {
        moderator = msg.sender;
        unrestricted = true;
    }

    function reassignModerator(address newModerator) public onlyModerator {
        moderator = newModerator;
    }

    function restrict() public onlyModerator {
        unrestricted = false;
    }

    function unrestrict() public onlyModerator {
        unrestricted = true;
    }

    /// This method can be used to extract tokens mistakenly sent to this contract.
    /// @param _token The address of the token contract that you want to recover
    function extract(address _token) public returns (bool) {
        require(_token != address(0x0));
        Token token = Token(_token);
        uint256 balance = token.balanceOf(this);
        return token.transfer(moderator, balance);
    }

    function isContract(address _addr) internal view returns (bool) {
        uint256 size;
        assembly { size := extcodesize(_addr) }
        return (size > 0);
    }
}
/**
 * @title Moderated
 * @dev restricts execution of 'onlyModerator' modified functions to the contract moderator
 * @dev restricts execution of 'ifUnrestricted' modified functions to when unrestricted
 *      boolean state is true
 * @dev allows for the extraction of ether or other ERC20 tokens mistakenly sent to this address
 */
function extract(address _token) public returns (bool) {
    require(_token != address(0x0));
    Token token = Token(_token);
    uint256 balance = token.balanceOf(this);
    return token.transfer(moderator, balance);
}

/// This method can be used to extract tokens mistakenly sent to this contract.
/// @param _token The address of the token contract that you want to recover