Index: apps/lang/english.lang
===================================================================
--- apps/lang/english.lang	(revision 13396)
+++ apps/lang/english.lang	(working copy)
@@ -10820,3 +10820,17 @@
     *: "Browse Cuesheet"
   </voice>
 </phrase>
+<phrase>
+  id: LANG_TAGCACHE_ALT_TAG_SORT
+  desc: in tag cache settings
+  user:
+  <source>
+    *: "Alt Tag Order"
+  </source>
+  <dest>
+    *: "Alt Tag Order"
+  </dest>
+  <voice>
+    *: "Alternative Tag Order"
+  </voice>
+</phrase>
Index: apps/settings.h
===================================================================
--- apps/settings.h	(revision 13396)
+++ apps/settings.h	(working copy)
@@ -571,6 +571,7 @@
     bool tagcache_ram;        /* load tagcache to ram? */
 #endif
     bool tagcache_autoupdate; /* automatically keep tagcache in sync? */
+    bool tagcache_alt_tag_sort; /* displays special tags such as <Untagged> last */
 #endif
     int default_codepage;   /* set default codepage for tag conversion */
 #ifdef HAVE_REMOTE_LCD
Index: apps/menus/settings_menu.c
===================================================================
--- apps/menus/settings_menu.c	(revision 13396)
+++ apps/menus/settings_menu.c	(working copy)
@@ -62,6 +62,7 @@
 MENUITEM_SETTING(tagcache_ram, &global_settings.tagcache_ram, NULL);
 #endif
 MENUITEM_SETTING(tagcache_autoupdate, &global_settings.tagcache_autoupdate, NULL);
+MENUITEM_SETTING(tagcache_alt_tag_sort, &global_settings.tagcache_alt_tag_sort, NULL);
 MENUITEM_FUNCTION(tc_init, 0, ID2P(LANG_TAGCACHE_FORCE_UPDATE),
                     (int(*)(void))tagcache_rebuild_with_splash, 
                     NULL, NULL, Icon_NOICON);
@@ -79,7 +80,7 @@
 #ifdef HAVE_TC_RAMCACHE
                 &tagcache_ram,
 #endif
-                &tagcache_autoupdate, &tc_init, &tc_update, &runtimedb,
+                &tagcache_alt_tag_sort, &tagcache_autoupdate, &tc_init, &tc_update, &runtimedb,
                 &tc_export, &tc_import);
 #endif /* HAVE_TAGCACHE */
 /*    TAGCACHE MENU                */
Index: apps/settings_list.c
===================================================================
--- apps/settings_list.c	(revision 13396)
+++ apps/settings_list.c	(working copy)
@@ -947,6 +947,8 @@
 #endif
     OFFON_SETTING(0,tagcache_autoupdate,
         LANG_TAGCACHE_AUTOUPDATE,false,"tagcache_autoupdate",NULL),
+    OFFON_SETTING(0,tagcache_alt_tag_sort,
+        LANG_TAGCACHE_ALT_TAG_SORT,false,"tagcache_alt_tag_sort",NULL),
 #endif
 #ifdef HAVE_LCD_BITMAP
     CHOICE_SETTING(0, default_codepage, LANG_DEFAULT_CODEPAGE, 0,
Index: apps/tagcache.c
===================================================================
--- apps/tagcache.c	(revision 13396)
+++ apps/tagcache.c	(working copy)
@@ -1777,10 +1777,10 @@
     {
         if (strcmp(e2->str, UNTAGGED) == 0)
             return 0;
-        return -1;
+        return global_settings.tagcache_alt_tag_sort ? 1 : -1;
     }
     else if (strcmp(e2->str, UNTAGGED) == 0)
-        return 1;
+        return global_settings.tagcache_alt_tag_sort ? -1 : 1;
     
     return strncasecmp(e1->str, e2->str, TAG_MAXLEN);
 }
Index: apps/tagtree.c
===================================================================
--- apps/tagtree.c	(revision 13396)
+++ apps/tagtree.c	(working copy)
@@ -1094,20 +1094,23 @@
         strip = 0;
     }
     
-    if (tag != tag_title && tag != tag_filename)
+    if (! global_settings.tagcache_alt_tag_sort)
     {
-        if (offset == 0)
+        if (tag != tag_title && tag != tag_filename)
         {
-            dptr->newtable = allsubentries;
-            dptr->name = str(LANG_TAGNAVI_ALL_TRACKS);
-            dptr++;
-            current_entry_count++;
+            if (offset == 0)
+            {
+                dptr->newtable = allsubentries;
+                dptr->name = str(LANG_TAGNAVI_ALL_TRACKS);
+                dptr++;
+                current_entry_count++;
+            }
+            special_entry_count++;
         }
-        special_entry_count++;
+    
+        total_count += special_entry_count;
     }
     
-    total_count += special_entry_count;
-    
     while (tagcache_get_next(tcs))
     {
         if (total_count++ < offset)
@@ -1197,6 +1200,23 @@
               current_entry_count - special_entry_count,
               c->dentry_size, compare);
     
+    if (global_settings.tagcache_alt_tag_sort)
+    {
+        if (tag != tag_title && tag != tag_filename)
+        {
+            if (offset == 0)
+            {
+                dptr->newtable = allsubentries;
+                dptr->name = str(LANG_TAGNAVI_ALL_TRACKS);
+                dptr++;
+                current_entry_count++;
+            }
+            special_entry_count++;
+        }
+    
+        total_count += special_entry_count;
+    }
+    
     if (!init)
     {
         tagcache_search_finish(tcs);
