function allocate(address receiver, uint tokenAmount, uint weiPrice, string customerId,  uint lockedTokenAmount) public onlyAllocateAgent {

    
    require(lockedTokenAmount <= tokenAmount);

    uint weiAmount = (weiPrice * tokenAmount)/10**uint(token.decimals()); 

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

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

    
    if (lockedTokenAmount > 0) {
      TokenVesting tokenVesting = TokenVesting(tokenVestingAddress);
      
      require(!tokenVesting.isVestingSet(receiver));
      assignTokens(tokenVestingAddress, lockedTokenAmount);
      
      tokenVesting.setVestingWithDefaultSchedule(receiver, lockedTokenAmount); 
    }

    
    if (tokenAmount - lockedTokenAmount > 0) {
      assignTokens(receiver, tokenAmount - lockedTokenAmount);
    }

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