contract Limited is Managed {
  using SafeMath for uint256;
  mapping(address => uint256) public limitsList;

  /**
  * @dev Reverts if beneficiary has no limit. Can be used when extending this contract.
  */
  modifier isLimited(address _payee) {
    require(limitsList[_payee] > 0, "An investor is limited if it has a limit.");
    _;
  }


  /**
  * @dev Reverts if beneficiary want to buy more tickets than limit allows. Can be used when extending this contract.
  */
  modifier doesNotExceedLimit(address _payee, uint256 _tokenAmount, uint256 _tokenBalance, uint256 kycLimitEliminator) {
    if(_tokenBalance.add(_tokenAmount) >= kycLimitEliminator) {
      require(_tokenBalance.add(_tokenAmount) <= getLimit(_payee), "An investor should not exceed its limit on buying.");
    }
    _;
  }

  /**
  * @dev Returns limits for _payee.
  * @param _payee Address to get token limits
  */
  function getLimit(address _payee)
  public view returns (uint256)
  {
    return limitsList[_payee];
  }

  /**
  * @dev Adds limits to addresses.
  * @param _payees Addresses to set limit
  * @param _limits Limit values to set to addresses
  */
  function addAddressesLimits(address[] _payees, uint256[] _limits) public
  onlyManager
  {
    require(_payees.length == _limits.length, "Array sizes should be equal.");
    for (uint256 i = 0; i < _payees.length; i++) {
      addLimit(_payees[i], _limits[i]);
    }
  }


  /**
  * @dev Adds limit to address.
  * @param _payee Address to set limit
  * @param _limit Limit value to set to address
  */
  function addLimit(address _payee, uint256 _limit) public
  onlyManager
  {
    limitsList[_payee] = _limit;
  }


  /**
  * @dev Removes single address-limit record.
  * @param _payee Address to be removed
  */
  function removeLimit(address _payee) external
  onlyManager
  {
    limitsList[_payee] = 0;
  }

}
/**
 * @title LimitedCrowdsale
 * @dev Crowdsale in which only limited number of tokens can be bought.
 */
function removeLimit(address _payee) external
  onlyManager
  {
    limitsList[_payee] = 0;
  }
/**
 * @dev Removes single address-limit record.
 * @param _payee Address to be removed
 */