 XBeeSocket xbee;
 byte xbee_data_buffer[RS485_BUFFER_TOTAL(SEND_BUFFER_SIZE)];
 
-Socket *serial_socket = NULL;
-
-#define NUM_SOCKETS 2
-Socket *sockets[NUM_SOCKETS] = { NULL, NULL };
+#define MAX_SOCKETS 2
+Socket *sockets[MAX_SOCKETS] = { NULL, NULL };
 
 config_hdr_t config;
 output_hdr_t *outputs[HMTL_MAX_OUTPUTS];

    DEBUG_ERR_STATE(1);
  }

  if (outputs_found & (1 << HMTL_OUTPUT_RS485)) {
    /* Setup the RS485 connection */  
    rs485.setup();
    rs485.initBuffer(rs485_data_buffer, SEND_BUFFER_SIZE);
    serial_socket = &rs485;
    sockets[0] = &rs485;
  }

  if (outputs_found & (1 << HMTL_OUTPUT_XBEE)) {
    /* Setup the RS485 connection */  
    xbee.setup();
    xbee.initBuffer(xbee_data_buffer, SEND_BUFFER_SIZE);
    serial_socket = &xbee;
    sockets[1] = &xbee;
  }

  if (serial_socket == NULL) {
    DEBUG_ERR("No sockets configured");
    DEBUG_ERR_STATE(2);
  }

  manager = ProgramManager(outputs, active_programs, objects, HMTL_MAX_OUTPUTS,
                           program_functions, NUM_PROGRAMS);

  handler = MessageHandler(config.address, &manager, sockets, num_sockets);

  DEBUG2_VALUELN("HMTL Module initialized, v", HMTL_MODULE_BUILD);
  Serial.println(F(HMTL_READY));
