diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/lib/Drupal/xhprof/EventSubscriber/XHProfSubscriber.php b/lib/Drupal/xhprof/EventSubscriber/XHProfSubscriber.php
new file mode 100644
index 0000000..3751d9e
--- /dev/null
+++ b/lib/Drupal/xhprof/EventSubscriber/XHProfSubscriber.php
@@ -0,0 +1,34 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\xhprof\EventSubscriber.
+ */
+
+namespace Drupal\xhprof\EventSubscriber;
+
+// use Symfony\Component\HttpKernel\KernelEvents;
+// use Symfony\Component\HttpKernel\Event\GetResponseEvent;
+use Symfony\Component\EventDispatcher\EventSubscriberInterface;
+
+class XHProfSubscriber implements EventSubscriberInterface {
+
+  /**
+   * A simple kernel listener method.
+   */
+  public function onKernelRequestTest() {
+    drupal_set_message(t('My event subscriber fired!'));
+  }
+
+  /**
+   * Registers methods as kernel listeners.
+   *
+   * @return array
+   *   An array of event listener definitions.
+   */
+  static function getSubscribedEvents() {
+    $events[KernelEvents::REQUEST][] = array('onKernelRequestTest', 100);
+    return $events;
+  }
+
+}
diff --git a/lib/Drupal/xhprof/XHProfBundle.php b/lib/Drupal/xhprof/XHProfBundle.php
new file mode 100644
index 0000000..c20975a
--- /dev/null
+++ b/lib/Drupal/xhprof/XHProfBundle.php
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\xhprof\XHProfBundle.
+ */
+
+namespace Drupal\xhprof;
+
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\HttpKernel\Bundle\Bundle;
+
+/**
+ * The bundle for xhprof.module.
+ */
+class XHProfBundle extends Bundle
+{
+  public function build(ContainerBuilder $container) {
+    $container->register('xhprof.xhprof_subscriber', 'Drupal\xhprof\XHProfSubscriber')
+      ->addTag('event_subscriber');
+  }
+}
\ No newline at end of file
diff --git a/lib/Drupal/xhprof/XHProfSubscriber.php b/lib/Drupal/xhprof/XHProfSubscriber.php
new file mode 100644
index 0000000..0d5fdef
--- /dev/null
+++ b/lib/Drupal/xhprof/XHProfSubscriber.php
@@ -0,0 +1,46 @@
+<?php
+/**
+ * @file
+ * Definition of Drupal\xhprof\XHProfSubscriber.
+ */
+
+namespace Drupal\xhprof;
+
+use Symfony\Component\HttpKernel\KernelEvents;
+use Drupal\Core\Config\StorageDispatcher;
+use Symfony\Component\HttpKernel\Event;
+use Symfony\Component\HttpKernel\Event\GetResponseEvent;
+use Drupal\Core\Language\LanguageManager;
+use Symfony\Component\EventDispatcher\EventSubscriberInterface;
+
+
+/**
+ * Locale Config helper
+ *
+ * $config is always a DrupalConfig object.
+ */
+class XHProfSubscriber implements EventSubscriberInterface {
+
+
+  /**
+   * Override configuration values with localized data.
+   *
+   * @param Symfony\Component\HttpKernel\Event\GetResponseEvent $event
+   *   The Event to process.
+   */
+  public function XHProfLoad(GetResponseEvent $event) {
+    // Initialize XHProf.
+    if (xhprof_xhprof_enable()) {
+      drupal_set_message('XHProf: subscribed');
+      drupal_register_shutdown_function('xhprof_shutdown');
+    }
+  }
+
+  /**
+   * Implements EventSubscriberInterface::getSubscribedEvents().
+   */
+  static function getSubscribedEvents() {
+    $events[KernelEvents::REQUEST][] = array('XHProfLoad', 999);
+    return $events;
+  }
+}
diff --git a/xhprof.module b/xhprof.module
index 5f121f2..192412c 100644
--- a/xhprof.module
+++ b/xhprof.module
@@ -118,16 +118,6 @@ function xhprof_is_enabled() {
 }
 
 /**
- * Implementation of hook_boot(). Runs even for cached pages.
- */
-function xhprof_boot() {
-  // Initialize XHProf.
-  if (xhprof_xhprof_enable()) {
-    drupal_register_shutdown_function('xhprof_shutdown');
-  }
-}
-
-/**
  * See xhprof_start() which registers this function as a shutdown function.
  */
 function xhprof_shutdown() {
