contract controlled{
  address public owner;
  uint256 public tokenFrozenUntilBlock;
  uint256 public tokenFrozenSinceBlock;
  uint256 public blockLock;

  mapping (address => bool) restrictedAddresses;

  // @dev Constructor function that sets freeze parameters so they don't unintentionally hinder operations.
  function controlled() public{
    owner = 0x24bF9FeCA8894A78d231f525c054048F5932dc6B;
    tokenFrozenSinceBlock = (2 ** 256) - 1;
    tokenFrozenUntilBlock = 0;
    blockLock = 5571500;
  }

  /*
  * @dev Transfers ownership rights to current owner to the new owner.
  * @param newOwner address Address to become the new SC owner.
  */
  function transferOwnership (address newOwner) onlyOwner public{
    owner = newOwner;
  }

  /*
  * @dev Allows owner to restrict or reenable addresses to use the token.
  * @param _restrictedAddress address Address of the user whose state we are planning to modify.
  * @param _restrict bool Restricts uder from using token. true restricts the address while false enables it.
  */
  function editRestrictedAddress(address _restrictedAddress, bool _restrict) public onlyOwner{
    if(!restrictedAddresses[_restrictedAddress] && _restrict){
      restrictedAddresses[_restrictedAddress] = _restrict;
    }
    else if(restrictedAddresses[_restrictedAddress] && !_restrict){
      restrictedAddresses[_restrictedAddress] = _restrict;
    }
    else{
      revert();
    }
  }



  /************ Modifiers to restrict access to functions. ************/

  // @dev Modifier to make sure the owner's functions are only called by the owner.
  modifier onlyOwner{
    require(msg.sender == owner);
    _;
  }

  /*
  * @dev Modifier to check whether destination of sender aren't forbidden from using the token.
  * @param _to address Address of the transfer destination.
  */
  modifier instForbiddenAddress(address _to){
    require(_to != 0x0);
    require(_to != address(this));
    require(!restrictedAddresses[_to]);
    require(!restrictedAddresses[msg.sender]);
    _;
  }

  // @dev Modifier to check if the token is operational at the moment.
  modifier unfrozenToken{
    require(block.number >= blockLock || msg.sender == owner);
    require(block.number >= tokenFrozenUntilBlock);
    require(block.number <= tokenFrozenSinceBlock);
    _;
  }
}
function editRestrictedAddress(address _restrictedAddress, bool _restrict) public onlyOwner{
  if(!restrictedAddresses[_restrictedAddress] && _restrict){
    restrictedAddresses[_restrictedAddress] = _restrict;
  }
  else if(restrictedAddresses[_restrictedAddress] && !_restrict){
    restrictedAddresses[_restrictedAddress] = _restrict;
  }
  else{
    revert();
  }
}

/*
 * @dev Allows owner to restrict or reenable addresses to use the token.
 * @param _restrictedAddress address Address of the user whose state we are planning to modify.
 * @param _restrict bool Restricts uder from using token. true restricts the address while false enables it.
 */