     //The PID set point in degrees per second is determined by the roll receiver input.
     //In the case of deviding by 3 the max roll rate is aprox 164 degrees per second ( (500-8)/3 = 164d/s ).
     pid_roll_setpoint = 0;
-  
+
     //We need a little dead band of 16us for better results.
     if (receiver_input_channel_4 > 1508) {
         pid_roll_setpoint = (receiver_input_channel_4 - 1508)/3.0;

    timer_channel_4 = esc_4 + loop_timer;                                     //Calculate the time of the faling edge of the esc-4 pulse.

    while(PORTD >= 16){                                                       //Stay in this loop until output 4,5,6 and 7 are low.
        
        esc_loop_timer = micros();                                              //Read the current time.
        
        if(timer_channel_1 <= esc_loop_timer) {
            PORTD &= B11101111;                //Set digital output 4 to low if the time is expired.
        }
        
        if(timer_channel_2 <= esc_loop_timer) {
            PORTD &= B11011111;                //Set digital output 5 to low if the time is expired.
        }
        
        if(timer_channel_3 <= esc_loop_timer) {
            PORTD &= B10111111;                //Set digital output 6 to low if the time is expired.
        }
        
        if(timer_channel_4 <= esc_loop_timer) {
            PORTD &= B01111111;                //Set digital output 7 to low if the time is expired.
        }

        last_channel_1 = 0;                                        //Remember current input state
        receiver_input_channel_1 = current_time - timer_1;         //Channel 1 is current_time - timer_1
    }

    //Channel 2=========================================
    if(PINB & B00000010 ){                                       //Is input 9 high?
        if(last_channel_2 == 0){                                   //Input 9 changed from 0 to 1
