               Serial.print(motor_speed); 
               Serial.write(' ');
               Serial.print(motor_acceleration); 
-                        }
-                        else
-                        if (tmp_str[i + 1] == 'P' || tmp_str[i + 1] == 'p'){ // get potentiometer min max home
+            }
+            else
+              if (tmp_str[i + 1] == 'P' || tmp_str[i + 1] == 'p'){ // get potentiometer min max home
                 int pot_index, pot_min, pot_max, pot_home;
                 sscanf(tmp_str + i + 2, "%d", &pot_index);
                 potentiometers_control.get_limits(pot_index, &pot_min, &pot_max, &pot_home);
-                              Serial.write("PP"); // potentiometer parameters
-              Serial.print(pot_index); 
-              Serial.write(' ');
-              Serial.print(pot_min);
-              Serial.write(' ');
-              Serial.print(pot_max);
-              Serial.write(' ');
-              Serial.print(pot_home);
-              Serial.write('#'); 
-                        }
-                        else
-                        {
+                Serial.write("PP"); // potentiometer parameters
+                Serial.print(pot_index); 
+                Serial.write(' ');
+                Serial.print(pot_min);
+                Serial.write(' ');
+                Serial.print(pot_max);
+                Serial.write(' ');
+                Serial.print(pot_home);
+                Serial.write('#'); 
+              }
+              else{
                           // for all motors, unformated data
             int index;
             for(index = 0; index < motors_control.num_motors; index++) {

            int sensor_index;
            sscanf(tmp_str + i + 1, "%d", &sensor_index);
            Serial.write('U');
            Serial.print(ultrasonic_sensors_controller.getDistanceForSensor(sensor_index));
            Serial.write('#');
            i++;

            int sensor_index;
            sscanf(tmp_str + i + 1, "%d", &sensor_index);
            Serial.write('P');
            Serial.print(sensor_index);
            Serial.write(' ');
            Serial.print(potentiometers_control.get_position(sensor_index));
            Serial.write('#');
            i++;
