function sell(uint256 amount) public returns (uint256 revenue){
        uint256 a = 0;
        
        require(initialSaleComplete);
        require(balances[msg.sender] >= amount);        
        
        a = _totalSupply - amount;

        uint256 p = 0;
        uint8 ps = 0;

        (p, ps) = power(1000008,1000000,(uint32)(1e5+1e5*_totalSupply/SU),1e5); 
        p=(S*p)>>ps;

        uint256 p2 = 0;
        uint8 ps2 = 0;

        (p2, ps2) = power(1000008,1000000,(uint32)(1e5+1e5*a/SU),1e5); 
        p2=(S*p2)>>ps2;

            

        revenue = (SU*p-SU*p2)*R/S;
        
       
        
        
        
        _totalSupply -= amount;                 
        require(balances[reserveAddress] >= revenue);
        balances[reserveAddress] -= revenue;             
        balances[msg.sender] -= amount;                 
        Contract reserve = Contract(reserveAddress);
        reserve.sendFunds(msg.sender, revenue);
        
        emit Transfer(msg.sender, reserveAddress, amount);               

        quoteAsk();
        quoteBid();  

        return revenue;                                 
    }