     Serial.println("not connected");
   }
 
+  /* tell the peer which is the network client */
   peer.init(client);
 
-  ledState = peer.state("ARDU/led", aJson.createItem((bool)true));
-  ledState->set_handler(set_led);
+  /* create a state with a "set" callback function (set_led).
+    the initial value is "true".
+    */
+  ledState = peer.state("ARDU/led", aJson.createItem((bool)true), set_led);
 
+  /* create two states for the analog inputs. no "set" callback function is
+    provided, so this is read-only.
+    in the loop function (every 100ms) new values a read out and are posted.
+   */
   analog1State = peer.state("ARDU/analog1", aJson.createItem(analogRead(0)));
   analog2State = peer.state("ARDU/analog2", aJson.createItem(analogRead(1)));
-   // initialize digital pin 13 as an output.
-  //pinMode(13, OUTPUT);
+
+  /* create a fetcher which is subsribed to the "own" state ARDU/analog1.
+     every time the value changes, the print_analog_1 function is called.
+     this is not very useful but demonstrates the principle.
+   */
+  peer.fetch("ARDU/analog1", print_analog_1);
+
 }
 
 long previousMillis = 0;
-long interval = 50;
-
+long interval = 100;
 
 void loop(void)
 {

  unsigned long currentMillis = millis();

  if(currentMillis - previousMillis > interval) {
    // save the last time you blinked the LED
    previousMillis = currentMillis;
    analog1State->value(aJson.createItem(analogRead(0)));
    analog2State->value(aJson.createItem(analogRead(1)));

  }
  return true;
}

/* a jet fetch callback function example */
void print_analog_1(const char* path, const char* event, aJsonObject* val, void* context) {
  Serial.print(path);Serial.print(F(" "));Serial.print(event);Serial.print(F(" "));Serial.println(val->valueint);
}
/**************************************************************************/
/*!
    @brief  Sets up the HW and the CC3000 module (called automatically
