[USE] Move pref
diff --git a/src/hb-ot-shape-complex-use-machine.rl b/src/hb-ot-shape-complex-use-machine.rl
index 77068bd..9cc9a23 100644
--- a/src/hb-ot-shape-complex-use-machine.rl
+++ b/src/hb-ot-shape-complex-use-machine.rl
@@ -55,6 +55,7 @@
 #CM	= 10; # CONS_MOD
 SUB	= 11; # CONS_SUB
 H	= 12; # HALANT
+
 HN	= 13; # HALANT_NUM
 ZWNJ	= 14; # Zero width non-joiner
 ZWJ	= 15; # Zero width joiner
@@ -64,8 +65,8 @@
 S	= 19; # SYM
 #SM	= 20; # SYM_MOD
 VS	= 21; # VARIATION_SELECTOR
-#V	= 22; # VOWEL
-#VM	= 23; # VOWEL_MOD
+#V	= 36; # VOWEL
+#VM	= 40; # VOWEL_MOD
 
 FAbv	= 24; # CONS_FINAL_ABOVE
 FBlw	= 25; # CONS_FINAL_BELOW
@@ -79,11 +80,11 @@
 VAbv	= 33; # VOWEL_ABOVE / VOWEL_ABOVE_BELOW / VOWEL_ABOVE_BELOW_POST / VOWEL_ABOVE_POST
 VBlw	= 34; # VOWEL_BELOW / VOWEL_BELOW_POST
 VPst	= 35; # VOWEL_POST	UIPC = Right
-VPre	= 36; # VOWEL_PRE / VOWEL_PRE_ABOVE / VOWEL_PRE_ABOVE_POST / VOWEL_PRE_POST
+VPre	= 22; # VOWEL_PRE / VOWEL_PRE_ABOVE / VOWEL_PRE_ABOVE_POST / VOWEL_PRE_POST
 VMAbv	= 37; # VOWEL_MOD_ABOVE
 VMBlw	= 38; # VOWEL_MOD_BELOW
 VMPst	= 39; # VOWEL_MOD_POST
-VMPre	= 40; # VOWEL_MOD_PRE
+VMPre	= 23; # VOWEL_MOD_PRE
 SMAbv	= 41; # SYM_MOD_ABOVE
 SMBlw	= 42; # SYM_MOD_BELOW
 
diff --git a/src/hb-ot-shape-complex-use-private.hh b/src/hb-ot-shape-complex-use-private.hh
index fc0cfc5..a143736 100644
--- a/src/hb-ot-shape-complex-use-private.hh
+++ b/src/hb-ot-shape-complex-use-private.hh
@@ -57,6 +57,7 @@
 //  USE_CM	= 10,	/* CONS_MOD */
   USE_SUB	= 11,	/* CONS_SUB */
   USE_H		= 12,	/* HALANT */
+
   USE_HN	= 13,	/* HALANT_NUM */
   USE_ZWNJ	= 14,	/* Zero width non-joiner */
   USE_ZWJ	= 15,	/* Zero width joiner */
@@ -66,8 +67,8 @@
   USE_S		= 19,	/* SYM */
 //  USE_SM	= 20,	/* SYM_MOD */
   USE_VS	= 21,	/* VARIATION_SELECTOR */
-//  USE_V		= 22,	/* VOWEL */
-//  USE_VM	= 23,	/* VOWEL_MOD */
+//  USE_V	= 36,	/* VOWEL */
+//  USE_VM	= 40,	/* VOWEL_MOD */
 
   USE_FAbv	= 24,	/* CONS_FINAL_ABOVE */
   USE_FBlw	= 25,	/* CONS_FINAL_BELOW */
@@ -81,11 +82,11 @@
   USE_VAbv	= 33,	/* VOWEL_ABOVE / VOWEL_ABOVE_BELOW / VOWEL_ABOVE_BELOW_POST / VOWEL_ABOVE_POST */
   USE_VBlw	= 34,	/* VOWEL_BELOW / VOWEL_BELOW_POST */
   USE_VPst	= 35,	/* VOWEL_POST	UIPC = Right */
-  USE_VPre	= 36,	/* VOWEL_PRE / VOWEL_PRE_ABOVE / VOWEL_PRE_ABOVE_POST / VOWEL_PRE_POST */
+  USE_VPre	= 22,	/* VOWEL_PRE / VOWEL_PRE_ABOVE / VOWEL_PRE_ABOVE_POST / VOWEL_PRE_POST */
   USE_VMAbv	= 37,	/* VOWEL_MOD_ABOVE */
   USE_VMBlw	= 38,	/* VOWEL_MOD_BELOW */
   USE_VMPst	= 39,	/* VOWEL_MOD_POST */
-  USE_VMPre	= 40,	/* VOWEL_MOD_PRE */
+  USE_VMPre	= 23,	/* VOWEL_MOD_PRE */
   USE_SMAbv	= 41,	/* SYM_MOD_ABOVE */
   USE_SMBlw	= 42	/* SYM_MOD_BELOW */
 };
diff --git a/src/hb-ot-shape-complex-use.cc b/src/hb-ot-shape-complex-use.cc
index 71d2ee1..b2c6543 100644
--- a/src/hb-ot-shape-complex-use.cc
+++ b/src/hb-ot-shape-complex-use.cc
@@ -347,8 +347,28 @@
       }
   }
 
-  /* TODO move things back. */
-
+  /* Move things back. */
+  unsigned int j = end;
+  for (unsigned int i = start; i < end; i++)
+  {
+    uint32_t flag = FLAG_UNSAFE (info[i].use_category());
+    if (flag & (HALANT_FLAGS | BASE_FLAGS))
+    {
+      /* If we hit a halant, move before it; otherwise it's a base: move to it's
+       * place, and shift things in between backward. */
+      if (info[i].use_category() == USE_H)
+	j = i + 1;
+      else
+	j = i;
+    }
+    else if (((flag) & (FLAG (USE_VPre) | FLAG (USE_VMPre))) && j < i)
+    {
+      hb_glyph_info_t t = info[i];
+      memmove (&info[j + 1], &info[j], (i - j) * sizeof (info[0]));
+      info[j] = t;
+      buffer->merge_clusters (j, i + 1);
+    }
+  }
 }
 
 static inline void