function investInternal(address receiver, string customerId) stopInEmergency private {

    
    if(getState() == State.PreFunding) {
      
      require(earlyParticipantWhitelist[receiver]);
    
    } else if(getState() == State.Funding) {
      
    } else {
      
      require(false);
    }

    uint weiAmount = msg.value;
    uint tokenAmount = pricingStrategy.calculatePrice(weiAmount, weiRaised, tokensSold, msg.sender, token.decimals());

    require(tokenAmount != 0);


    if(investedAmountOf[receiver] == 0) {
       
       investorCount++;
    }

    
    investedAmountOf[receiver] = safeAdd(investedAmountOf[receiver],weiAmount);
    tokenAmountOf[receiver] = safeAdd(tokenAmountOf[receiver],tokenAmount);

    
    weiRaised = safeAdd(weiRaised,weiAmount);
    tokensSold = safeAdd(tokensSold,tokenAmount);

    
    require(!isBreakingCap(weiAmount, tokenAmount, weiRaised, tokensSold));
    
    
    

    assignTokens(receiver, tokenAmount);

    
    require(multisigWallet.send(weiAmount));

    
    Invested(receiver, weiAmount, tokenAmount, customerId);
  }