function investInternal(address receiver, uint128 customerId) stopInEmergency notFinished private {
    
    if (getState() == State.PreFunding) {
      
      require(earlyParticipantWhitelist[receiver]);
    }

    uint weiAmount;
    uint tokenAmount;
    (weiAmount, tokenAmount) = calculateTokenAmount(msg.value, msg.sender);
    
    assert(weiAmount <= msg.value);
    
    
    require(tokenAmount != 0);

    if (investedAmountOf[receiver] == 0) {
      
      investorCount++;
    }
    updateInvestorFunds(tokenAmount, weiAmount, receiver, customerId);

    
    multisigWallet.transfer(weiAmount);

    
    returnExcedent(msg.value.sub(weiAmount), msg.sender);
  }