function buy(address recipient) payable returns (uint){
        require(tx.gasprice <= 50000000000 wei);

        require(!haltSale);
        require(saleStarted());
        require(!saleEnded());

        uint weiPayment = eligibleTestAndIncrement(recipient, msg.value);

        require(weiPayment > 0);

        
        if (msg.value > weiPayment) {
            msg.sender.transfer(msg.value.sub(weiPayment));
        }

        
        sendETHToMultiSig(weiPayment);
        raisedWei = raisedWei.add(weiPayment);

        uint recievedTokens = 0;

        if (now < openSaleStartTime) {
            recievedTokens = weiPayment.mul(tokensPerEthPresale);
        }
        else {
            recievedTokens = weiPayment.mul(tokensPerEthPublicSale);
        }

        assert(token.transfer(recipient, recievedTokens));


        Buy(recipient, recievedTokens, weiPayment);

        return weiPayment;
    }