contract IndividualCapCrowdsale is Crowdsale, Ownable {
  using SafeMath for uint256;

  uint256 public minAmount;
  uint256 public maxAmount;

  mapping(address => uint256) public contributions;

  function IndividualCapCrowdsale(uint256 _minAmount, uint256 _maxAmount) public {
    require(_minAmount > 0);
    require(_maxAmount > _minAmount);

    minAmount = _minAmount;
    maxAmount = _maxAmount;
  }

  /**
   * @dev Set the minimum amount in wei that can be invested per each purchase
   * @param _minAmount Minimum Amount of wei to be invested per each purchase
   */
  function setMinAmount(uint256 _minAmount) public onlyOwner {
    require(_minAmount > 0);
    require(_minAmount < maxAmount);

    minAmount = _minAmount;
  }

  /**
   * @dev Set the overall maximum amount in wei that can be invested by user
   * @param _maxAmount Maximum Amount of wei allowed to be invested by any user
   */
  function setMaxAmount(uint256 _maxAmount) public onlyOwner {
    require(_maxAmount > 0);
    require(_maxAmount > minAmount);

    maxAmount = _maxAmount;
  }

  /**
   * @dev Extend parent behavior requiring purchase to have minimum weiAmount and be within overall maxWeiAmount
   * @param _beneficiary Token purchaser
   * @param _weiAmount Amount of wei contributed
   */
  function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal {
    require(_weiAmount >= minAmount);
    super._preValidatePurchase(_beneficiary, _weiAmount);
    require(contributions[_beneficiary].add(_weiAmount) <= maxAmount);
  }

  /**
   * @dev Extend parent behavior to update user contributions
   * @param _beneficiary Token purchaser
   * @param _weiAmount Amount of wei contributed
   */
  function _updatePurchasingState(address _beneficiary, uint256 _weiAmount) internal {
    super._updatePurchasingState(_beneficiary, _weiAmount);
    contributions[_beneficiary] = contributions[_beneficiary].add(_weiAmount);
  }
}
function setMinAmount(uint256 _minAmount) public onlyOwner {
  require(_minAmount > 0);
  require(_minAmount < maxAmount);

  minAmount = _minAmount;
}

/**
 * @dev Set the minimum amount in wei that can be invested per each purchase
 * @param _minAmount Minimum Amount of wei to be invested per each purchase
 */