function
    function buyTokens(address beneficiary, uint256 amount) onlyAuthorised whenNotPaused internal {

        setTier(r);

    
        require(amount >= minContribution);
        require(amount <= maxContribution);

    
        uint256 tokens = amount.mul(rate);

    
        weiRaised = weiRaised.add(amount);
        if (token.balanceOf(beneficiary) == 0) {
            numberOfPurchasers++;
      }
        tokenRaised = tokenRaised.add(tokens); 
        token.mint(beneficiary, tokens);
        TokenPurchase(beneficiary, amount, tokens);
        multiSig.transfer(this.balance); 
    }