function collectAuthorizedPayment(uint _idPayment) {

        
        if (_idPayment >= authorizedPayments.length) throw;

        Payment p = authorizedPayments[_idPayment];

        
        if (msg.sender != p.recipient) throw;
        if (!allowedSpenders[p.spender]) throw;
        if (now < p.earliestPayTime) throw;
        if (p.canceled) throw;
        if (p.paid) throw;
        if (this.balance < p.amount) throw;

        p.paid = true; 
        if (!p.recipient.send(p.amount)) {  
            throw;
        }
        PaymentExecuted(_idPayment, p.recipient, p.amount);
     }