 
 	if (tmp_str[i + 1] == 'M' || tmp_str[i + 1] == 'm') {
 		// move motor
-		int motor_index, num_steps;
+		uint8_t motor_index;
+		int num_steps;
 		int num_consumed;
-		int num_read = sscanf(tmp_str + i + 2, "%d%d%n", &motor_index, &num_steps, &num_consumed);
+		int num_read = sscanf(tmp_str + i + 2, "%hhu%d%n", &motor_index, &num_steps, &num_consumed);
 		if (num_read != 2) {
-			sprintf(tmp_serial_out, "E#");
+			strcpy(tmp_serial_out, "E#");
 			i += 2;
 			return;
 		}
-			steppers_controller.move_motor(motor_index, num_steps);
-			is_command_running = 1;
-			i += 2 + num_consumed;
+		steppers_controller.move_motor(motor_index, num_steps);
+		is_command_running = 1;
+		i += 2 + num_consumed;
 	}
 	else
 		if (tmp_str[i + 1] == 'D' || tmp_str[i + 1] == 'd') {
 			// disable motor
-			int motor_index;
-			int num_read = sscanf(tmp_str + i + 2, "%d", &motor_index);
+			uint8_t motor_index;
+			int num_read = sscanf(tmp_str + i + 2, "%hhu", &motor_index);
 			if (num_read != 1) {
-				sprintf(tmp_serial_out, "E#");
+				strcpy(tmp_serial_out, "E#");
 				i += 2;
 				return;
 			}
-				steppers_controller.disable(motor_index);
-				sprintf(tmp_serial_out, "SD%d#", motor_index);
-				i += 4;
+			steppers_controller.disable(motor_index);
+			sprintf(tmp_serial_out, "SD%d#", motor_index);
+			i += 4;
 		}
 		else
 			if (tmp_str[i + 1] == 'L' || tmp_str[i + 1] == 'l') {
 				// locks motor
-				int motor_index;
-				int num_read = sscanf(tmp_str + i + 2, "%d", &motor_index);
+				uint8_t motor_index;
+				int num_read = sscanf(tmp_str + i + 2, "%hhu", &motor_index);
 				if (num_read != 1) {
-					sprintf(tmp_serial_out, "E#");
+					strcpy(tmp_serial_out, "E#");
 					i += 2;
 					return;
 				}
-					steppers_controller.lock(motor_index);
-					sprintf(tmp_serial_out, "SL%d#", motor_index);
-					i += 4;
+				steppers_controller.lock(motor_index);
+				sprintf(tmp_serial_out, "SL%d#", motor_index);
+				i += 4;
 				
 			}
 			else
 				if (tmp_str[i + 1] == 'S' || tmp_str[i + 1] == 's') {
 					// stepper motor speed and acceleration
-					int motor_index;
+					uint8_t motor_index;
 					int motor_speed, motor_acceleration;
 					int num_consumed;
-					int num_read = sscanf(tmp_str + i + 2, "%d%d%d%n", &motor_index, &motor_speed, &motor_acceleration, &num_consumed);
+					int num_read = sscanf(tmp_str + i + 2, "%hhu%d%d%n", &motor_index, &motor_speed, &motor_acceleration, &num_consumed);
 					if (num_read != 3) {
-						sprintf(tmp_serial_out, "E#");
+						strcpy(tmp_serial_out, "E#");
 						i += 2;
 						return;
 					}


char is_command_running;

const char* firmware_version = "2019.05.02.0"; // year.month.day.build number

#define MAX_BUFFER_LENGTH 65


			k++;
		}
		else if (tmp_str[j] == 'B' || tmp_str[j] == 'b') {//buttons
			uint8_t sensor_index;
			int8_t _direction;
			int num_consumed;
			int num_read = sscanf(tmp_str + j + 1, "%hhu%hhd%n", &sensor_index, &_direction, &num_consumed);
			if (num_read != 2) {
				strcpy(tmp_serial_out, "E#");
				i += 2;
				return;
		}
			if (motor_type == 'S' || motor_type == 's') // attach to stepper motors controller
				steppers_controller.add_sensor(motor_index, BUTTON, sensor_index, 0, 0, 0, _direction);
			else
