 #endif
 
   // clears bond data on every boot
-//  bleBondStore.clearData();
-  
+  bleBondStore.clearData();
+
   blePeripheral.setBondStore(bleBondStore);
 
-  blePeripheral.setAdvertisedServiceUuid(ancsService.uuid());
+  blePeripheral.setServiceSolicitationUuid(ancsService.uuid());
   blePeripheral.setLocalName("ANCS");
 
   // set device name and appearance
   blePeripheral.setDeviceName("Arduino ANCS");
   blePeripheral.setAppearance(0x0080);
 
-  // add service, characteristic, and decriptor to peripheral
-  blePeripheral.addAttribute(batteryService);
-  blePeripheral.addAttribute(batteryLevelCharacteristic);
-  
   blePeripheral.addRemoteAttribute(ancsService);
   blePeripheral.addRemoteAttribute(ancsNotificationSourceCharacteristic);
   blePeripheral.addRemoteAttribute(ancsControlPointCharacteristic);
   blePeripheral.addRemoteAttribute(ancsDataSourceCharacteristic);
-  
-  batteryLevelCharacteristic.setValue(100);
-  
+
   // assign event handlers for connected, disconnected to peripheral
   blePeripheral.setEventHandler(BLEConnected, blePeripheralConnectHandler);
   blePeripheral.setEventHandler(BLEDisconnected, blePeripheralDisconnectHandler);
+  blePeripheral.setEventHandler(BLEBonded, blePeripheralBondedHandler);
+  blePeripheral.setEventHandler(BLERemoteServicesDiscovered, blePeripheralRemoteServicesDiscoveredHandler);
 
   // assign event handlers for characteristic
   ancsNotificationSourceCharacteristic.setEventHandler(BLEValueUpdated, ancsNotificationSourceCharacteristicValueUpdated);

BLEPeripheral                    blePeripheral                            = BLEPeripheral(BLE_REQ, BLE_RDY, BLE_RST);
BLEBondStore                     bleBondStore;

// local services
BLEService                       batteryService                           = BLEService("180f");

// local characteristics
BLEUnsignedCharCharacteristic    batteryLevelCharacteristic               = BLEUnsignedCharCharacteristic("2a19", BLERead);

// remote services
BLERemoteService                 ancsService                              = BLERemoteService("7905f431b5ce4e99a40f4b1e122d00d0");
                                                                                              
// remote characteristics
BLERemoteCharacteristic          ancsNotificationSourceCharacteristic     = BLERemoteCharacteristic("9fbf120d630142d98c5825e699a21dbd", BLENotify);
BLERemoteCharacteristic          ancsControlPointCharacteristic           = BLERemoteCharacteristic("69d1d8f345e149a898219bbdfdaad9d9", BLEWrite);

  // central disconnected event handler
  Serial.print(F("Disconnected event, central: "));
  Serial.println(central.address());
}

void blePeripheralBondedHandler(BLECentral& central) {
  // central bonded event handler
  Serial.print(F("Remote bonded event, central: "));
  Serial.println(central.address());

  if (ancsNotificationSourceCharacteristic.canSubscribe()) {
    ancsNotificationSourceCharacteristic.subscribe();
  }
}

void blePeripheralRemoteServicesDiscoveredHandler(BLECentral& central) {
  // central remote services discovered event handler
  Serial.print(F("Remote services discovered event, central: "));
  Serial.println(central.address());

  if (ancsNotificationSourceCharacteristic.canSubscribe()) {
    ancsNotificationSourceCharacteristic.subscribe();
  }
}

enum AncsNotificationEventId {
