     //Split topic elements
     strcpy(buffer, topic);
     fillTopicElements();
-
 
     //ON    
     if (strcmp(topicElements[4], "on")==0) {

        Serial.println("Connected to MQTT broker");
    #endif

    //Publish gateway abilities and conencted hardware    
    Publish(STR_GATEWAY, STR_ONLINE, true);
    Publish(STR_GATEWAY_L1, STR_ONLINE, true);
    Publish(STR_GATEWAY_X10, STR_ONLINE, true);

  return client.publish(getString(STR_GATEWAY_RAM), (uint8_t*)mem, strlen(mem), true);
}

//Check Magic packet in UDP, soft reset if kill command found
void checkUDP() {

  // if there's data available, read a packet
  int packetSize = Udp.parsePacket();
  
  if(packetSize) {    
    char contents = Udp.read();    
    // send a reply, to the IP address and port that sent us the packet we received
    Udp.beginPacket(Udp.remoteIP(), Udp.remotePort());
    
    if (contents == 'K') {

      Udp.write('1');      
      Udp.endPacket();

      #if DEBUG            
        Serial << "RESETTING..." << endl;
      #endif
      
      //Software Reset
      software_Reset();

    } else {

      Udp.write('0');
      Udp.endPacket();
    }        
  }
}

// Restarts program from beginning but does not reset the peripherals and registers
void software_Reset() {
  asm volatile ("  jmp 0");
}

//Return size of PROGMEM variable
// byte size(prog_uchar *var) {
//   return sizeof(var)-1;
