function transfer(address _to, uint256 _value) public {
    	if (balanceOf[msg.sender] < _value) revert();
        if (balanceOf[_to] + _value < balanceOf[_to]) revert();
        
        uint256 avp = 0;
        uint256 amount = 0;
        
        
        if ( _to == address(this) ) {
        	
        	if ( lastTxBlockNum < (block.number-5000) ) {
        		avp = this.balance * 1000000000 / totalSupply;
        		amount = ( _value * avp ) / 1000000000;
        	} else {
	        	amount = ( _value * redeemPrice ) / 1000000000;
	        }
        	balanceOf[msg.sender] -= _value;
        	totalSupply -= _value;
        	        	
        	
	    	if ( totalSupply != 0 ) {
	    		avp = (this.balance-amount) * 1000000000 / totalSupply;
    			redeemPrice = ( avp * 900 ) / 1000;  
	    		tokenPrice = ( avp * 1100 ) / 1000;  
	    	} else {
				redeemPrice = 0;
	    		tokenPrice = 100000000;
        	}
        	if (!msg.sender.send(amount)) revert();
        	Transfer(msg.sender, 0x0, _value);
        } else {
        	balanceOf[msg.sender] -= _value;
	        balanceOf[_to] += _value;
        	Transfer(msg.sender, _to, _value);
        }        
    }