diff --git a/nice_menus.module b/nice_menus.module
index 4944830..e545d19 100644
--- a/nice_menus.module
+++ b/nice_menus.module
@@ -285,9 +285,6 @@ function nice_menus_theme() {
     'nice_menus_secondary_menu' => array(
       'variables' => array('direction' => 'down', 'depth' => -1),
     ),
-    'nice_menus_menu_item_link' => array(
-      'variables' => array('element' => array()),
-    ),
   );
 }
 
@@ -420,64 +417,57 @@ function theme_nice_menus_build($variables) {
   }
   // Get to building the menu.
   foreach ($menu as $menu_item) {
+    $children = NULL;
+    $class = array();
     $mlid = $menu_item['link']['mlid'];
+    $class[] = 'menu-' . $mlid;
     // Check to see if it is a visible menu item.
     if (!isset($menu_item['link']['hidden']) || $menu_item['link']['hidden'] == 0) {
       // Check our count and build first, last, odd/even classes.
       $index++;
-      $first_class = $index == 1 ? ' first ' : '';
-      $oddeven_class = $index % 2 == 0 ? ' even ' : ' odd ';
-      $last_class = $index == $count ? ' last ' : '';
+      if ($index == 1) {
+        $class[] = 'first';
+      }
+      $class[] = $index % 2 == 0 ? 'even' : 'odd';
+      if ($index == $count) {
+        $class[] = 'last';
+      }
       // Build class name based on menu path
       // e.g. to give each menu item individual style.
       // Strip funny symbols.
       $clean_path = str_replace(array('http://', 'www', '<', '>', '&', '=', '?', ':', '.'), '', $menu_item['link']['href']);
       // Convert slashes to dashes.
       $clean_path = str_replace('/', '-', $clean_path);
-      $class = 'menu-path-' . $clean_path;
+      $class[] = 'menu-path-' . $clean_path;
       if ($trail && in_array($mlid, $trail)) {
-        $class .= ' active-trail';
+        $class[] = 'active-trail';
       }
       // If it has children build a nice little tree under it.
       if ((!empty($menu_item['link']['has_children'])) && (!empty($menu_item['below'])) && $depth != 0) {
         // Keep passing children into the function 'til we get them all.
-        $children = theme('nice_menus_build', array('menu' => $menu_item['below'], 'depth' => $depth, 'trail' => $trail));
-        // Set the class to parent only of children are displayed.
-        $parent_class = ($children && ($menu_item['link']['depth'] <= $depth || $depth == -1)) ? 'menuparent ' : '';
-         
-         $element = array(
-          '#below' => '',
-          '#title' => $menu_item['link']['link_title'],
-          '#href' =>  $menu_item['link']['href'],
-          '#localized_options' => $menu_item['link']['localized_options'],
-          '#attributes' => array(),
-        );
-        $variables['element'] = $element;
-        
-        $output .= '<li class="menu-' . $mlid . ' ' . $parent_class . $class . $first_class . $oddeven_class . $last_class . '">'. theme('nice_menus_menu_item_link', $variables);
-        // Check our depth parameters.
-        if ($menu_item['link']['depth'] <= $depth || $depth == -1) {
-          // Build the child UL only if children are displayed for the user.
-          if ($children) {
-            $output .= '<ul>';
-            $output .= $children;
-            $output .= "</ul>\n";
-          }
-        }
-        $output .= "</li>\n";
+        $children = '<ul>' . theme('nice_menus_build', array('menu' => $menu_item['below'], 'depth' => $depth, 'trail' => $trail)) . '</ul>';
+        // Set the class to parent only if children are displayed.
+        $class[] = 'menuparent';
       }
-      else {
-     
-        $element = array(
-          '#below' => '',
-          '#title' => $menu_item['link']['link_title'],
-          '#href' =>  $menu_item['link']['href'],
-          '#localized_options' => $menu_item['link']['localized_options'],
-          '#attributes' => array(),
-        );
-        $variables['element'] = $element;
-        $output .= '<li class="menu-' . $mlid . ' ' . $class . $first_class . $oddeven_class . $last_class . '">' . theme('nice_menus_menu_item_link', $variables) . "</li>\n";
+
+      $variables['element'] = array(
+        '#below' => '',
+        '#title' => $menu_item['link']['link_title'],
+        '#href' =>  $menu_item['link']['href'],
+        '#localized_options' => $menu_item['link']['localized_options'],
+        '#attributes' => array('class' => $class),
+      );
+
+      $menu_link = theme('menu_link', $variables);
+
+      // This is a dirty, dirty hack. There has to be a better way to do this, manipulating
+      // $menu_item['below'] into a format that can be passed to drupal_render, by way of
+      // $variables['element']['#below'] when theme_menu_link is called. Unfortunately,
+      // I don't know enough about render arrays to do this.
+      if ($children) {
+        $menu_link = str_replace('</li>', $children . '</li>', $menu_link);
       }
+      $output .= $menu_link;
     }
   }
   return $output;
@@ -566,15 +556,3 @@ function theme_nice_menus_secondary_menu($variables) {
   $output = theme('nice_menus', array('id' => 0, 'menu_name' => $menu_name, 'mlid' => 0, 'direction' => $direction, 'depth' => $depth));
   return $output['content'];
 }
-
-/**
- * Generate the HTML output for a single menu link.
- *
- * Function is a backport of Drupal 6
- */
-function theme_nice_menus_menu_item_link($variables) {
-  if (empty($variables['element']['#localized_options'])) {
-    $variables['element']['#localized_options'] = array();
-  }
-  return l($variables['element']['#title'], $variables['element']['#href'], $variables['element']['#localized_options']);
-}
