diff --git a/sharethis.module b/sharethis.module
index fdb427e..f3a89f6 100644
--- a/sharethis.module
+++ b/sharethis.module
@@ -370,14 +370,14 @@ function sharethis_node_view($node, $view_mode, $langcode) {
             '#tag' => 'div', // Wrap it in a div.
             '#type' => 'html_tag',
             '#attributes' => array('class' => 'sharethis-buttons'),
-            '#value' => sharethis_get_button_HTML($data_options, $mPath, $mTitle),
+            '#value' => theme('sharethis', array('data_options' => $data_options, 'm_path' => $mPath, 'm_title' => $mTitle)),
             '#weight' => intval(variable_get('sharethis_weight', 10)),
           );
         break;
         case 'links':
           $links['sharethis'] = array(
             'html' => TRUE,
-            'title' => sharethis_get_button_HTML($data_options, $mPath, $mTitle),
+            'title' => theme('sharethis', array('data_options' => $data_options, 'm_path' => $mPath, 'm_title' => $mTitle)),
             'attributes' => array('class' => 'sharethis-buttons'),
           );
           $node->content['links']['sharethis'] = array(
@@ -397,30 +397,28 @@ function sharethis_node_view($node, $view_mode, $langcode) {
 }
 
 /**
- * sharethisGetOptionArray is a helper function for DB access.
- *
- * Returns options that have been stored in the database.
- *
- * @TODO: Switch from this function to just straight variable_get() calls.
+ * Implementation of hook_theme().
  */
-function sharethis_get_options_array() {
-  return array(
-    'buttons' => variable_get('sharethis_button_option', 'stbc_large'),
-    'nodeType' => variable_get('sharethis_node_option', 'page,article'),
-    'publisherID' => variable_get('sharethis_publisherID', ''),
-    'services' => variable_get('sharethis_service_option', '"Tweet:twitter","Facebook:facebook","ShareThis:sharethis"'),
-    'option_extras' => variable_get('sharethis_option_extras', array()),
-    'viewMode' => variable_get('sharethis_teaser_option', 0),
-    'widget' => variable_get('sharethis_widget_option', 'st_multi'),
-    'twitter_suffix' => variable_get('sharethis_twitter_suffix', ''),
+function sharethis_theme($existing, $type, $theme, $path) {
+  $theme = array();
+  $theme['sharethis'] = array(
+    'variables' => array(
+      'data_options' => NULL,
+      'm_path' => NULL,
+      'm_title' => NULL,
+    ),
   );
+  return $theme;
 }
 
 /**
- * sharethisGet_button_HTML is the function that creates the ShareThis code
- * It returns the appropriate html based on your settings.
+ * Theme function for ShareThis code based on settings.
  */
-function sharethis_get_button_HTML($data_options, $mPath, $mTitle) {
+function theme_sharethis($variables) {
+  $data_options = $variables['data_options'];
+  $m_path = $variables['m_path'];
+  $m_title = $variables['m_title'];
+
   // Inject the extra services.
   foreach ($data_options['option_extras'] as $service) {
     $data_options['services'] .= ',"' . $service . '"';
@@ -438,7 +436,7 @@ function sharethis_get_button_HTML($data_options, $mPath, $mTitle) {
     $display = substr($service[0], 1);
 
     // Switch the title on a per-service basis if required.
-    $title = $mTitle;
+    $title = $m_title;
     switch ($serviceCodeName) {
       case 'twitter':
         $title = empty($data_options['twitter_suffix']) ? $mTitle : $mTitle . ' ' . $data_options['twitter_suffix'];
@@ -447,7 +445,7 @@ function sharethis_get_button_HTML($data_options, $mPath, $mTitle) {
 
     // Put together the span attributes.
     $attributes = array(
-      'st_url' => $mPath,
+      'st_url' => $m_path,
       'st_title' => $title,
       'class' => 'st_' . $serviceCodeName . $type,
     );
@@ -485,6 +483,26 @@ function sharethis_get_button_HTML($data_options, $mPath, $mTitle) {
 }
 
 /**
+ * sharethisGetOptionArray is a helper function for DB access.
+ *
+ * Returns options that have been stored in the database.
+ *
+ * @TODO: Switch from this function to just straight variable_get() calls.
+ */
+function sharethis_get_options_array() {
+  return array(
+    'buttons' => variable_get('sharethis_button_option', 'stbc_large'),
+    'nodeType' => variable_get('sharethis_node_option', 'page,article'),
+    'publisherID' => variable_get('sharethis_publisherID', ''),
+    'services' => variable_get('sharethis_service_option', '"Tweet:twitter","Facebook:facebook","ShareThis:sharethis"'),
+    'option_extras' => variable_get('sharethis_option_extras', array()),
+    'viewMode' => variable_get('sharethis_teaser_option', 0),
+    'widget' => variable_get('sharethis_widget_option', 'st_multi'),
+    'twitter_suffix' => variable_get('sharethis_twitter_suffix', ''),
+  );
+}
+
+/**
  * Implements hook_block_info().
  */
 function sharethis_block_info() {
@@ -518,7 +536,7 @@ function sharethis_block_contents() {
     $path = isset($_GET['q']) ? $_GET['q'] : '<front>';
     $mPath = url($_GET['q'], array('absolute' => TRUE));
     $mTitle = drupal_get_title();
-    return sharethis_get_button_HTML($data_options, $mPath, $mTitle);
+    return theme('sharethis', array($data_options, $mPath, $mTitle));
   }
 }
 
