   if (Serial.available()) {
     int data = Serial.read();
     if (data == CMD_HEADER_A) {
+      Serial.print("CA");
       serial_index = 0;
     } else {
       serial_buffer[serial_index++] = data;

  }

  if (serial_buffer[0] == CMD_HEADER_B && serial_index > 1) {
    if (serial_index > 1 + arglen[serial_buffer[1]]) {
      int res;
      switch (serial_buffer[1]) {
      case CMD_mug_seek:
	// int
	res = mug_seek(serial_buffer[2]);
	break;
      case CMD_mug_get:
	res = mug_get();
	break;
      case CMD_kcup_tray_open:
	res = kcup_tray_open();
	break;
      case CMD_kcup_tray_close:
	res = kcup_tray_close();
	break;
      case CMD_kcup_load:

  arglen[CMD_kcup_count] = 0;
  arglen[CMD_brew] = 0;
  arglen[CMD_addin_insert] = 2;

  mug_seek(0);
}

int main() {
