--- phpbb2drupal.module.orig	2006-10-09 05:05:28.000000000 -0400
+++ phpbb2drupal.module	2006-11-09 23:16:06.000000000 -0500
@@ -1881,25 +1881,7 @@ function phpbb2drupal_comment_save($edit
         // Strip the "/" from the end of the thread.
         $max = rtrim($max, '/');
 
-        // Next, we increase this value by one.  Note that we can't
-        // use 1, 2, 3, ... 9, 10, 11 because we order by string and
-        // 10 would be right after 1.  We use 1, 2, 3, ..., 9, 91,
-        // 92, 93, ... instead.  Ugly but fast.
-        $decimals = (string) substr($max, 0, strlen($max) - 1);
-        $units = substr($max, -1, 1);
-        if ($units) {
-            $units++;
-        }
-        else {
-            $units = 1;
-        }
-
-        if ($units == 10) {
-            $units = '90';
-        }
-
-        // Finally, build the thread field for this new comment.
-        $thread = $decimals . $units .'/';
+		$thread = int2vancode(vancode2int($max)+1) . '/';
     }
     else {
         // This is comment with a parent comment: we increase
@@ -1916,7 +1898,7 @@ function phpbb2drupal_comment_save($edit
 
         if ($max == '') {
             // First child of this parent.
-            $thread = $parent->thread .'.1/';
+            $thread = $parent->thread .'.'.int2vancode(1).'/';
         }
         else {
             // Strip the "/" at the end of the thread.
@@ -1927,19 +1909,8 @@ function phpbb2drupal_comment_save($edit
             $parent_depth = count(explode('.', $parent->thread));
             $last = $parts[$parent_depth];
 
-            // Next, we increase this value by one.  Note that we can't
-            // use 1, 2, 3, ... 9, 10, 11 because we order by string and
-            // 10 would be right after 1.  We use 1, 2, 3, ..., 9, 91,
-            // 92, 93, ... instead.  Ugly but fast.
-            $decimals = (string)substr($last, 0, strlen($last) - 1);
-            $units = substr($last, -1, 1);
-            $units++;
-            if ($units == 10) {
-                $units = '90';
-            }
-
             // Finally, build the thread field for this new comment.
-            $thread = $parent->thread .'.'. $decimals . $units .'/';
+            $thread = $parent->thread .'.'.int2vancode(vancode2int($last) + 1) .'/';
         } 
     }
 
