function withdraw()
        senderVerify()
        playerVerify()
        public
    {
        require(getRefBalance(msg.sender) > 0 || getPlayerBalance(msg.sender) > 0);

    	address playerAddress = msg.sender;
    	uint256 withdrawAmount = 0;
    	if(getRefBalance(playerAddress) > 0){
    		withdrawAmount = withdrawAmount.add(getRefBalance(playerAddress));
    		player[playerAddress].refBalance = 0;
    	}

    	if(getPlayerBalance(playerAddress) > 0){
    		withdrawAmount = withdrawAmount.add(getPlayerBalance(playerAddress));
    		player[playerAddress].withdrawRid = rId;
    	}
    	playerAddress.transfer(withdrawAmount);
    }