diff --git a/gelf.drush.inc b/gelf.drush.inc
index 9073fcb..89551ae 100644
--- a/gelf.drush.inc
+++ b/gelf.drush.inc
@@ -20,7 +20,7 @@ function gelf_drush_command() {
 }
 
 /**
- * Implementation of hook_drush_help().
+ * Implements hook_drush_help().
  */
 function gelf_drush_help($section) {
   switch ($section) {
@@ -40,7 +40,7 @@ function drush_gelf_download() {
   else {
     $path = drush_get_context('DRUSH_DRUPAL_ROOT');
     if (module_exists('libraries')) {
-      $path .= '/' . libraries_get_path('') . '/gelf-php';
+      $path .= '/' . libraries_get_path('') . 'gelf-php';
     }
   }
 
diff --git a/gelf.info b/gelf.info
index 98e35ab..eeea8e2 100644
--- a/gelf.info
+++ b/gelf.info
@@ -1,4 +1,5 @@
 name = GELF
 description = "Sends watchdog messages to Graylog2 using the GELF format."
-core = 6.x
+core = 7.x
 dependencies[] = libraries
+
diff --git a/gelf.module b/gelf.module
index 3a83a9b..17ebd23 100644
--- a/gelf.module
+++ b/gelf.module
@@ -7,64 +7,102 @@
  */
 
 /**
- * Implementation of hook_menu()
+ * Implements hook_menu().
  *
  * Set up admin settings callbacks, etc.
  */
 function gelf_menu() {
   $items = array();
-  $items['admin/settings/logging/gelf'] = array(
+  $items['admin/config/gelf'] = array(
+    'title' => 'Gelf Settings',
+    'description' => 'Settings for logging to Graylog2 using GELF.',
+    'position' => 'right',
+    'weight' => '-5',
+    'page callback' => 'system_admin_menu_block_page',
+    'access arguments' => array('administer site configuration'),
+    'file' => 'system.admin.inc',
+    'file path' => drupal_get_path('module', 'system'),
+  );
+
+  $items['admin/config/gelf/settings'] = array(
     'title' => 'GELF settings',
     'description' => 'Settings for logging to Graylog2 using GELF.',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('gelf_admin_settings_form'),
     'access arguments' => array('administer gelf'),
+    'position' => 'right',
   );
   return $items;
 }
 
 /**
- * Implemetation of hook_perm()
+ * Implements hook_permission().
  *
  * Allows admins to control access to gelf settings.
  */
-function gelf_perm() {
-  return array('administer gelf');
+function gelf_permission() {
+  return array(
+    'administer gelf' => array(
+      'title' => t('administer gelf'),
+      'description' => t('Manage graylog2 host settings'),
+    ),
+  );
 }
 
 /**
- * Implement hook_watchdog().
+ * Implements hook_watchdog().
  */
 function gelf_watchdog($entry) {
-  if (module_exists('libraries') && $gelflib_path = libraries_get_path('gelf-php') . '/gelf.php') {
-    if (file_exists($gelflib_path)) {
-      require_once $gelflib_path;
-      $host = variable_get('gelf_host', 'localhost');
-      $port = variable_get('gelf_port', 12201);
-      $gelf = new GELFMessage($host, $port);
+  static $gelf_publisher;
+
+  // Check if the libraries dependency is installed
+  if (module_exists('libraries')) {
+    $gelfmsg_path = libraries_get_path('gelf-php') . '/GELFMessage.php';
+    $gelfpub_path = libraries_get_path('gelf-php') . '/GELFMessagePublisher.php';
+
+    // Check if the php-gelf library is available
+    if (file_exists(DRUPAL_ROOT . '/' . $gelfmsg_path) && file_exists(DRUPAL_ROOT . '/' . $gelfpub_path)) {
+      require_once DRUPAL_ROOT . '/' . $gelfmsg_path;
+      require_once DRUPAL_ROOT . '/' . $gelfpub_path;
+
+      // Set up the gelf message publisher
+      if (!isset($gelf_publisher)) {
+        $host = variable_get('gelf_host', 'localhost');
+        $port = variable_get('gelf_port', 12201);
+        $gelf_publisher = new GELFMessagePublisher($host, $port);
+      }
+
+      $username = isset($entry['user']->name) ? $entry['user']->name : variable_get('anonymous', t('Anonymous'));
       $message = strip_tags(is_null($entry['variables']) ? $entry['message'] : strtr($entry['message'], $entry['variables']));
       $short_msg_length = 100;
-      if(strlen($message) > $short_msg_length) {
-        $short_message = preg_replace('/\s+?(\S+)?$/u', '', substr($message, 0, $short_msg_length));
+      if (drupal_strlen($message) > $short_msg_length) {
+        $short_message = preg_replace('/\s+?(\S+)?$/u', '', drupal_substr($message, 0, $short_msg_length));
       }
       else {
         $short_message = $message;
       }
-      $username = isset($entry['user']->name) ? $entry['user']->name : variable_get('anonymous', t('Anonymous'));
-      $gelf->setShortMessage($short_message);
-      $gelf->setFullMessage($message);
-      $gelf->setHost(php_uname('n'));
-      $gelf->setFacility($entry['type']);
-      $gelf->setLevel($entry['severity']);
-      $gelf->setTimestamp($entry['timestamp']);
-      $gelf->setAdditional("Referer", $entry['referer']);
-      $gelf->setAdditional("Link", $entry['link']);
-      $gelf->setAdditional("Username", $username);
-      $gelf->setAdditional("Uid", $entry['user']->uid);
-      $gelf->setAdditional("Request_uri", $entry['request_uri']);
-      $gelf->setAdditional("Server_host", $_SERVER['HTTP_HOST']);
-      $gelf->setAdditional("Client_host", $entry['ip']);
-      $gelf->send();
+
+      // Build the gelf message
+      $gelf_message = new GELFMessage();
+      $gelf_message->setShortMessage($short_message);
+      $gelf_message->setFullMessage($message);
+      $gelf_message->setHost(php_uname('n'));
+      $gelf_message->setFacility($entry['type']);
+      $gelf_message->setLevel($entry['severity']);
+      $gelf_message->setTimestamp($entry['timestamp']);
+      $gelf_message->setAdditional("Referer", $entry['referer']);
+      $gelf_message->setAdditional("Link", $entry['link']);
+      $gelf_message->setAdditional("Username", $username);
+      $gelf_message->setAdditional("Uid", $entry['user']->uid);
+      $gelf_message->setAdditional("Request_uri", $entry['request_uri']);
+      $gelf_message->setAdditional("Server_host", $_SERVER['HTTP_HOST']);
+      $gelf_message->setAdditional("Client_host", $entry['ip']);
+
+      // Publish the gelf message
+      $gelf_publisher->publish($gelf_message);
+    }
+    else {
+      drupal_set_message(t('GELF module requires gelf-php to be installed!'), 'error');
     }
   }
   else {
@@ -75,7 +113,7 @@ function gelf_watchdog($entry) {
 /**
  * Menu callback for GELF admin settings.
  */
-function gelf_admin_settings_form() {
+function gelf_admin_settings_form($form, &$form_state) {
   $form = array();
 
   $form['gelf_host'] = array(
