   if (!digitalRead(KEY_CANCEL)) {
     // cancel the alarm
     while(!digitalRead(KEY_CANCEL)); // debounce
-    Serial.print("Cancelled!");
-    alarm *cancelled = alarms.pop();
-    if (cancelled) {
-      cancelled->sounding = FALSE;
-      free(cancelled); 
-    }
-    AS.KillTheAlarm();
+    Serial.println("Cancelled via button!");
+    cancel();
   } else if (!setting && !digitalRead(KEY_OK)) {
     // enter the setting mode
     while(!digitalRead(KEY_OK)); // debouncing

  now = rtc.now(); // update the now

  // initialise the rest api  
  rest.function("setAlarm", setAlarm);
  rest.set_id("001");
  rest.set_name("SmartAlarm");


        if (a = (alarm *)malloc(sizeof(alarm))) {
          a->set = newalarm;
          a->active = true;
          a->next = NULL;
          alarms.push(a);
        }
        setting = false;
