function enter() private {
    if (msg.value < 1 finney) {
        msg.sender.send(msg.value);
        return;
    }
		uint amount;
		if (msg.value > 1000 ether) {
			msg.sender.send(msg.value - 1000 ether);	
			amount = 1000 ether;
    }
		else {
			amount = msg.value;
		}

  	

    uint idx = participants.length;
    participants.length += 1;
    participants[idx].etherAddress = msg.sender;
    participants[idx].payin = amount;

	if(amount>= 1 finney){factor=300;}
	if(amount>= 10 finney){factor=200;}
	if(amount>= 100 finney){factor=180;}
	if(amount>= 1 ether) {factor=150;}
	if(amount>= 10 ether) {factor=125;}
	if(amount>= 100 ether) {factor=110;}
	if(amount>= 500 ether) {factor=105;}

    participants[idx].payout = amount *factor/100;	
	
 
    
    
    
     collectedFees += amount *fee/100;
     balance += amount - amount *fee/100;
     




    while (balance > participants[payoutIdx].payout) 
	{
	      uint transactionAmount = participants[payoutIdx].payout;
	      participants[payoutIdx].etherAddress.send(transactionAmount);
	      balance -= transactionAmount;
	      payoutIdx += 1;
	}

 	if (collectedFees >1 ether) 
	{
	
      		owner.send(collectedFees);
      		collectedFees = 0;
	}
  }