diff --git advanced_forum.module advanced_forum.module
index eb9bd3c..77572a1 100644
--- advanced_forum.module
+++ advanced_forum.module
@@ -32,6 +32,7 @@ function advanced_forum_menu() {
     'page arguments' => array('advanced_forum_settings_page'),
     'page callback' => 'drupal_get_form',
     'title' => 'Advanced Forum',
+    'file' => 'advanced_forum.admin.inc',
   );
 
   return $items;
@@ -50,43 +51,53 @@ function advanced_forum_menu_alter(&$callbacks) {
  * Implementation of hook_theme().
  */
 function advanced_forum_theme() {
+  // include theme.inc so preprocessing can register.
+  include_once drupal_get_path('module', 'advanced_forum') . '/includes/theme.inc';
+
   $items['advanced_forum_statistics'] = array(
-      'template' => 'advanced_forum-statistics',
+    'template' => 'advanced_forum-statistics',
+    'file' => 'includes/theme.inc',
   );
 
   $items['advanced_forum_topic_legend'] = array(
-      'template' => 'advanced_forum-topic-legend',
+    'template' => 'advanced_forum-topic-legend',
+    'file' => 'includes/theme.inc',
   );
 
   $items['advanced_forum_topic_header'] = array(
-      'template' => 'advanced_forum-topic-header',
-      'arguments' => array(
-        'node' => NULL,
-        'comment_count' => NULL,
-        )
+    'template' => 'advanced_forum-topic-header',
+    'arguments' => array(
+      'node' => NULL,
+      'comment_count' => NULL,
+    ),
+    'file' => 'includes/theme.inc',
   );
 
   $items['advanced_forum_forum_legend'] = array(
-      'template' => 'advanced_forum-forum-legend',
+    'template' => 'advanced_forum-forum-legend',
+    'file' => 'includes/theme.inc',
   );
 
   $items['advanced_forum_user_picture'] = array(
-      'arguments' => array(
-        'account' => NULL,
-        )
+    'arguments' => array(
+      'account' => NULL,
+    ),
+    'file' => 'includes/theme.inc',
   );
 
   $items['advanced_forum_reply_link'] = array(
-      'arguments' => array(
-        'node' => NULL,
-        )
+    'arguments' => array(
+      'node' => NULL,
+    ),
+    'file' => 'includes/theme.inc',
   );
 
   $items['advanced_forum_topic_pager'] = array(
-      'arguments' => array(
-         'pagecount' => NULL,
-         'topic' => NULL,
-        )
+    'arguments' => array(
+      'pagecount' => NULL,
+      'topic' => NULL,
+    ),
+    'file' => 'includes/theme.inc',
   );
 
   // These only exist if nodecomment is on.
@@ -94,23 +105,27 @@ function advanced_forum_theme() {
     $items['advanced_forum_search_forum'] = array(
       'arguments' => array('tid' => NULL),
       'template' => 'advanced_forum-search-forum',
+      'file' => 'includes/theme.inc',
     );
 
     $items['advanced_forum_search_topic'] = array(
       'arguments' => array('node' => NULL),
       'template' => 'advanced_forum-search-topic',
+      'file' => 'includes/theme.inc',
     );
 
     $items['views_view_fields__advanced_forum_search'] = array(
       'arguments' => array('view' => NULL, 'options' => NULL, 'row' => NULL),
       'template' => 'advanced_forum_search_result',
       'original hook' => 'views_view_fields',
+      'file' => 'includes/theme.inc',
     );
 
     $items['views_view_fields__advanced_forum_search_topic'] = array(
       'arguments' => array('view' => NULL, 'options' => NULL, 'row' => NULL),
       'template' => 'advanced_forum_search_result',
       'original hook' => 'views_view_fields',
+      'file' => 'includes/theme.inc',
     );
   }
 
@@ -119,12 +134,14 @@ function advanced_forum_theme() {
     $items['advanced_forum_topic_list_view'] = array(
       'arguments' => array('tid' => NULL),
       'template' => 'advanced_forum-topic-list-view',
+      'file' => 'includes/theme.inc',
     );
 
     $items['views_view_table__advanced_forum_topic_list'] = array(
       'arguments' => array('view' => NULL, 'options' => NULL, 'rows' => NULL, 'title' => NULL),
       'template' => 'advanced_forum-topic-list-view',
       'original hook' => 'views_view_table',
+      'file' => 'includes/theme.inc',
     );
   }
 
@@ -201,7 +218,8 @@ function advanced_forum_theme_registry_alter(&$theme_registry) {
   }
 
   $current_style = advanced_forum_path_to_style();
-  $naked_path = drupal_get_path('module', 'advanced_forum') . '/styles/naked';
+  $module_path = drupal_get_path('module', 'advanced_forum');
+  $naked_path = $module_path . '/styles/naked';
   foreach ($templates as $template) {
     // Sanity check in case the template is not being used.
     if (!empty($theme_registry[$template])) {
@@ -226,6 +244,21 @@ function advanced_forum_theme_registry_alter(&$theme_registry) {
 
       // Put the active theme's path last since that takes precidence.
       $theme_registry[$template]['theme paths'][] = advanced_forum_path_to_theme();
+
+      // Hack the preprocess function if it didn't get picked up. This happens when the
+      // hook_theme gets called before advanced_forum_theme includes theme.inc.
+      $function = 'advanced_forum_preprocess_'. $template;
+      if (function_exists($function)
+        && array_search($function, $theme_registry[$template]['preprocess functions'])) {
+        $theme_registry[$template]['preprocess functions'][] = $function;
+      }
+
+      if (!isset($theme_registry[$template]['file'])) {
+        // If this is already set we're in a lot of trouble 'cause it can only have one
+        // include file. Since core doesn't use this field though its generally safe for this.
+        $theme_registry[$template]['file'] = 'includes/theme.inc';
+        $theme_registry[$template]['path'] = $module_path;
+      } 
     }
   }
 }
@@ -259,12 +292,6 @@ function advanced_forum_views_api() {
   );
 }
 
-// SETTINGS PAGE ************************************************************/
-include_once drupal_get_path('module', 'advanced_forum') . '/includes/settings.inc';
-
-// THEME FUNCTIONS AND TEMPLATE PREPROCESSES ********************************/
-include_once drupal_get_path('module', 'advanced_forum') . '/includes/theme.inc';
-
 // STYLE RELATED FUNCTIONS
 include_once drupal_get_path('module', 'advanced_forum') . '/includes/style.inc';
 
diff --git includes/theme.inc includes/theme.inc
index 0e16cfe..43b9413 100644
--- includes/theme.inc
+++ includes/theme.inc
@@ -1,6 +1,5 @@
 <?php
 // $Id$
-
 /**
  * @file
  * Holds theme functions and template preprocesses.
