diff --git a/asterix-maven-plugins/record-manager-generator-maven-plugin/src/main/java/edu/uci/ics/asterix/recordmanagergenerator/RecordType.java b/asterix-maven-plugins/record-manager-generator-maven-plugin/src/main/java/edu/uci/ics/asterix/recordmanagergenerator/RecordType.java
index d102481..2a87511 100644
--- a/asterix-maven-plugins/record-manager-generator-maven-plugin/src/main/java/edu/uci/ics/asterix/recordmanagergenerator/RecordType.java
+++ b/asterix-maven-plugins/record-manager-generator-maven-plugin/src/main/java/edu/uci/ics/asterix/recordmanagergenerator/RecordType.java
@@ -23,7 +23,6 @@
         BYTE,
         SHORT,
         INT,
-        LOCAL,
         GLOBAL
     }
     
@@ -111,11 +110,11 @@
               sb.append("if (TRACK_ALLOC) checkSlot(slotNum);\n");
             }
             sb = indent(sb, indent, level + 1);
-            sb.append("final int arenaId = arenaId(slotNum);\n");
+            sb.append("final int arenaId = RecordManagerTypes.Global.arenaId(slotNum);\n");
             sb = indent(sb, indent, level + 1);
             sb.append("return get(arenaId).")
               .append(methodName("get"))
-              .append("(localId(slotNum));\n");
+              .append("(RecordManagerTypes.Global.localId(slotNum));\n");
             sb = indent(sb, indent, level);
             sb.append("}\n");
             return sb;
@@ -133,11 +132,11 @@
               sb.append("if (TRACK_ALLOC) checkSlot(slotNum);\n");
             }
             sb = indent(sb, indent, level + 1);
-            sb.append("final int arenaId = arenaId(slotNum);\n");
+            sb.append("final int arenaId = RecordManagerTypes.Global.arenaId(slotNum);\n");
             sb = indent(sb, indent, level + 1);
             sb.append("get(arenaId).")
               .append(methodName("set"))
-              .append("(localId(slotNum), value);\n");
+              .append("(RecordManagerTypes.Global.localId(slotNum), value);\n");
             sb = indent(sb, indent, level);
             sb.append("}\n");
             return sb;
@@ -233,7 +232,6 @@
             case BYTE:   return 1;
             case SHORT:  return 2;
             case INT:    return 4;
-            case LOCAL:  return 4;
             case GLOBAL: return 8;
             default:     throw new IllegalArgumentException();
         }
@@ -244,7 +242,6 @@
             case BYTE:   return "byte";
             case SHORT:  return "short";
             case INT:    return "int";
-            case LOCAL:  return "int";
             case GLOBAL: return "long";
             default:     throw new IllegalArgumentException();
         }
@@ -255,7 +252,6 @@
             case BYTE:   return "get";
             case SHORT:  return "getShort";
             case INT:    return "getInt";
-            case LOCAL:  return "getInt";
             case GLOBAL: return "getLong";
             default:     throw new IllegalArgumentException();
         }
@@ -266,7 +262,6 @@
             case BYTE:   return "put";
             case SHORT:  return "putShort";
             case INT:    return "putInt";
-            case LOCAL:  return "putInt";
             case GLOBAL: return "putLong";
             default:     throw new IllegalArgumentException();
         }
@@ -277,12 +272,21 @@
             case BYTE:   return "(byte)0xde";
             case SHORT:  return "(short)0xdead";
             case INT:    return "0xdeadbeef";
-            case LOCAL:  return "0xdeadbeef";
             case GLOBAL: return "0xdeadbeefdeadbeefl";
             default:     throw new IllegalArgumentException();
         }        
     }
     
+    static String appender(Type t) {
+        switch(t) {
+            case BYTE:   return "RecordManagerTypes.Byte.append";
+            case SHORT:  return "RecordManagerTypes.Short.append";
+            case INT:    return "RecordManagerTypes.Int.append";
+            case GLOBAL: return "RecordManagerTypes.Global.append";
+            default:     throw new IllegalArgumentException();
+        }        
+    }
+    
     static String padRight(String s, int n) {
         return String.format("%1$-" + n + "s", s);  
     }
@@ -331,17 +335,9 @@
               .append(field.offsetName())
               .append(");\n");
             sb = indent(sb, indent, level + 1);
-            sb.append("sb.append(String.format(\"%1$2x\", ")
-              .append(name)
-              .append("ArenaManager.arenaId(value)));\n");
-            sb = indent(sb, indent, level + 1);
-            sb.append("sb.append(\" \");\n");
-            sb = indent(sb, indent, level + 1);
-            sb.append("sb.append(String.format(\"%1$6x\", ")
-              .append(name)
-              .append("ArenaManager.localId(value)));\n");
-            sb = indent(sb, indent, level + 1);
-            sb.append("sb.append(\" | \");\n");
+            sb.append("sb = ")
+              .append(appender(field.type))
+              .append("(sb, value);\n");
             sb = indent(sb, indent, level);
             sb.append("}\n");
             sb = indent(sb, indent, level);
diff --git a/asterix-maven-plugins/record-manager-generator-maven-plugin/src/main/resources/ArenaManager.java b/asterix-maven-plugins/record-manager-generator-maven-plugin/src/main/resources/ArenaManager.java
index e7d5590..5d0a2d8 100644
--- a/asterix-maven-plugins/record-manager-generator-maven-plugin/src/main/resources/ArenaManager.java
+++ b/asterix-maven-plugins/record-manager-generator-maven-plugin/src/main/resources/ArenaManager.java
@@ -18,6 +18,7 @@
 import java.util.ArrayList;
 
 import edu.uci.ics.asterix.transaction.management.service.locking.AllocInfo;
+import edu.uci.ics.asterix.transaction.management.service.locking.RecordManagerTypes;
 
 public class @E@ArenaManager {
     
@@ -39,18 +40,6 @@
             }
         };
     }
-    
-    public static int arenaId(long l) {
-        return (int)((l >>> 48) & 0xffff);
-    }
-
-    public static int allocId(long l) {
-        return (int)((l >>> 32) & 0xffff);
-    }
-
-    public static int localId(long l) {
-        return (int) (l & 0xffffffffL);
-    }
 
     public long allocate() {
         final LocalManager localManager = local.get();
@@ -62,10 +51,10 @@
             final long allocId = (++localManager.mgr.allocCounter % 0x7fff);
             result |= (allocId << 32);
             setAllocId(result, (short) allocId);
-            assert allocId(result) == allocId;
+            assert RecordManagerTypes.Global.allocId(result) == allocId;
         }
-        assert arenaId(result) == localManager.arenaId;
-        assert localId(result) == localId;
+        assert RecordManagerTypes.Global.arenaId(result) == localManager.arenaId;
+        assert RecordManagerTypes.Global.localId(result) == localId;
         return result;
     }
     
@@ -73,8 +62,8 @@
         if (TRACK_ALLOC) {
             checkSlot(slotNum);
         }
-        final int arenaId = arenaId(slotNum);
-        get(arenaId).deallocate(localId(slotNum));
+        final int arenaId = RecordManagerTypes.Global.arenaId(slotNum);
+        get(arenaId).deallocate(RecordManagerTypes.Global.localId(slotNum));
     }
     
     public synchronized LocalManager getNext() {
@@ -100,13 +89,13 @@
     @METHODS@
     
     private void checkSlot(long slotNum) {
-        final int refAllocId = allocId(slotNum);
+        final int refAllocId = RecordManagerTypes.Global.allocId(slotNum);
         final short curAllocId = getAllocId(slotNum);
         if (refAllocId != curAllocId) {
             String msg = "reference to slot " + slotNum
-                + " of arena " + arenaId(slotNum) + " refers to version " 
-                + Integer.toHexString(refAllocId) + " current version is "
-                + Integer.toHexString(curAllocId);
+                + " of arena " + RecordManagerTypes.Global.arenaId(slotNum)
+                + " refers to version " + Integer.toHexString(refAllocId)
+                + " current version is " + Integer.toHexString(curAllocId);
             AllocInfo a = getAllocInfo(slotNum);
             if (a != null) {
                 msg += "\n" + a.toString();
@@ -116,8 +105,8 @@
     }
     
     public AllocInfo getAllocInfo(long slotNum) {
-        final int arenaId = arenaId(slotNum);
-        return get(arenaId).getAllocInfo(localId(slotNum));
+        final int arenaId = RecordManagerTypes.Global.arenaId(slotNum);
+        return get(arenaId).getAllocInfo(RecordManagerTypes.Global.localId(slotNum));
     }
     
     static class LocalManager {
@@ -125,7 +114,7 @@
         @E@RecordManager mgr;
     }
     
-    StringBuffer append(StringBuffer sb) {
+    public StringBuilder append(StringBuilder sb) {
         for (int i = 0; i < arenas.size(); ++i) {
             sb.append("++++ arena ").append(i).append(" ++++\n");
             arenas.get(i).append(sb);
@@ -134,6 +123,6 @@
     }
     
     public String toString() {
-        return append(new StringBuffer()).toString();
+        return append(new StringBuilder()).toString();
     }
 }
diff --git a/asterix-maven-plugins/record-manager-generator-maven-plugin/src/main/resources/RecordManager.java b/asterix-maven-plugins/record-manager-generator-maven-plugin/src/main/resources/RecordManager.java
index 03ac51f..a4e560d 100644
--- a/asterix-maven-plugins/record-manager-generator-maven-plugin/src/main/resources/RecordManager.java
+++ b/asterix-maven-plugins/record-manager-generator-maven-plugin/src/main/resources/RecordManager.java
@@ -173,7 +173,7 @@
         }
     }
     
-    StringBuffer append(StringBuffer sb) {
+    StringBuilder append(StringBuilder sb) {
         sb.append("+++ current: ")
           .append(current)
           .append(" no occupied slots: ")
@@ -187,7 +187,7 @@
     }
     
     public String toString() {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         append(sb);
         return sb.toString();
     }
@@ -263,7 +263,7 @@
             bb.putInt(slotNum * ITEM_SIZE + NEXT_FREE_SLOT_OFFSET, nextFreeSlot);
         }
 
-        StringBuffer append(StringBuffer sb) {
+        StringBuilder append(StringBuilder sb) {
             sb.append("++ free slot: ")
               .append(freeSlotNum)
               .append(" no occupied slots: ")
@@ -274,9 +274,7 @@
         }
         
         public String toString() {
-            StringBuffer sb = new StringBuffer();
-            append(sb);
-            return sb.toString();
+            return append(new StringBuilder()).toString();
         }
         
         private void checkSlot(int slotNum) {
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/ConcurrentLockManager.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/ConcurrentLockManager.java
index 359b58e..18997e5 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/ConcurrentLockManager.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/ConcurrentLockManager.java
@@ -761,6 +761,38 @@
         return fromLockMode == LockMode.S && toLockMode == LockMode.X;
     }
 
+    public StringBuilder append(StringBuilder sb) {
+        sb.append(">>dump_begin\t>>----- [resTable] -----\n");
+        table.append(sb);
+        sb.append(">>dump_end\t>>----- [resTable] -----\n");
+
+        sb.append(">>dump_begin\t>>----- [resArenaMgr] -----\n");
+        resArenaMgr.append(sb);
+        sb.append(">>dump_end\t>>----- [resArenaMgr] -----\n");
+        
+        sb.append(">>dump_begin\t>>----- [reqArenaMgr] -----\n");
+        reqArenaMgr.append(sb);
+        sb.append(">>dump_end\t>>----- [reqArenaMgr] -----\n");
+        
+        sb.append(">>dump_begin\t>>----- [jobIdSlotMap] -----\n");
+        for(Integer i : jobIdSlotMap.keySet()) {
+            sb.append(i).append(" : ");
+            RecordManagerTypes.Global.append(sb, jobIdSlotMap.get(i));
+            sb.append("\n");
+        }
+        sb.append(">>dump_end\t>>----- [jobIdSlotMap] -----\n");
+
+        sb.append(">>dump_begin\t>>----- [jobArenaMgr] -----\n");
+        jobArenaMgr.append(sb);
+        sb.append(">>dump_end\t>>----- [jobArenaMgr] -----\n");
+
+        return sb;
+    }
+    
+    public String toString() {
+        return append(new StringBuilder()).toString();
+    }
+    
     @Override
     public String prettyPrint() throws ACIDException {
         StringBuilder s = new StringBuilder("\n########### LockManager Status #############\n");
@@ -775,26 +807,8 @@
     @Override
     public void stop(boolean dumpState, OutputStream os) {
         if (dumpState) {
-
-            //#. dump Configurable Variables
-            dumpConfVars(os);
-
-            //#. dump jobHT
-            dumpJobInfo(os);
-
-            //#. dump datasetResourceHT
-            dumpDatasetLockInfo(os);
-
-            //#. dump entityLockInfoManager
-            dumpEntityLockInfo(os);
-
-            //#. dump entityInfoManager
-            dumpEntityInfo(os);
-
-            //#. dump lockWaiterManager
-
-            dumpLockWaiterInfo(os);
             try {
+                os.write(toString().getBytes());
                 os.flush();
             } catch (IOException e) {
                 //ignore
@@ -802,157 +816,6 @@
         }
     }
 
-    private void dumpConfVars(OutputStream os) {
-        try {
-            StringBuilder sb = new StringBuilder();
-            sb.append("\n>>dump_begin\t>>----- [ConfVars] -----");
-            sb.append("\nESCALATE_TRHESHOLD_ENTITY_TO_DATASET: "
-                    + txnSubsystem.getTransactionProperties().getEntityToDatasetLockEscalationThreshold());
-//            sb.append("\nSHRINK_TIMER_THRESHOLD (entityLockInfoManager): "
-//                    + entityLockInfoManager.getShrinkTimerThreshold());
-//            sb.append("\nSHRINK_TIMER_THRESHOLD (entityInfoManager): " + entityInfoManager.getShrinkTimerThreshold());
-//            sb.append("\nSHRINK_TIMER_THRESHOLD (lockWaiterManager): " + lockWaiterManager.getShrinkTimerThreshold());
-            sb.append("\n>>dump_end\t>>----- [ConfVars] -----\n");
-            os.write(sb.toString().getBytes());
-        } catch (Exception e) {
-            //ignore exception and continue dumping as much as possible.
-            if (IS_DEBUG_MODE) {
-                e.printStackTrace();
-            }
-        }
-    }
-
-    private void dumpJobInfo(OutputStream os) {
-        JobId jobId;
-        JobInfo jobInfo;
-        StringBuilder sb = new StringBuilder();
-/*
-        try {
-            sb.append("\n>>dump_begin\t>>----- [JobInfo] -----");
-            Set<Map.Entry<JobId, JobInfo>> entrySet = jobHT.entrySet();
-            if (entrySet != null) {
-                for (Map.Entry<JobId, JobInfo> entry : entrySet) {
-                    if (entry != null) {
-                        jobId = entry.getKey();
-                        if (jobId != null) {
-                            sb.append("\n" + jobId);
-                        } else {
-                            sb.append("\nJID:null");
-                        }
-
-                        jobInfo = entry.getValue();
-                        if (jobInfo != null) {
-                            sb.append(jobInfo.coreDump());
-                        } else {
-                            sb.append("\nJobInfo:null");
-                        }
-                    }
-                }
-            }
-            sb.append("\n>>dump_end\t>>----- [JobInfo] -----\n");
-            os.write(sb.toString().getBytes());
-        } catch (Exception e) {
-            //ignore exception and continue dumping as much as possible.
-            if (IS_DEBUG_MODE) {
-                e.printStackTrace();
-            }
-        }
-*/
-    }
-
-    private void dumpDatasetLockInfo(OutputStream os) {
-/*
-        DatasetId datasetId;
-        DatasetLockInfo datasetLockInfo;
-        StringBuilder sb = new StringBuilder();
-
-        try {
-            sb.append("\n>>dump_begin\t>>----- [DatasetLockInfo] -----");
-            Set<Map.Entry<DatasetId, DatasetLockInfo>> entrySet = datasetResourceHT.entrySet();
-            if (entrySet != null) {
-                for (Map.Entry<DatasetId, DatasetLockInfo> entry : entrySet) {
-                    if (entry != null) {
-                        datasetId = entry.getKey();
-                        if (datasetId != null) {
-                            sb.append("\nDatasetId:" + datasetId.getId());
-                        } else {
-                            sb.append("\nDatasetId:null");
-                        }
-
-                        datasetLockInfo = entry.getValue();
-                        if (datasetLockInfo != null) {
-                            sb.append(datasetLockInfo.coreDump());
-                        } else {
-                            sb.append("\nDatasetLockInfo:null");
-                        }
-                    }
-                    sb.append("\n>>dump_end\t>>----- [DatasetLockInfo] -----\n");
-                    os.write(sb.toString().getBytes());
-
-                    //create a new sb to avoid possible OOM exception
-                    sb = new StringBuilder();
-                }
-            }
-        } catch (Exception e) {
-            //ignore exception and continue dumping as much as possible.
-            if (IS_DEBUG_MODE) {
-                e.printStackTrace();
-            }
-        }
-*/
-    }
-
-    private void dumpEntityLockInfo(OutputStream os) {
-/*
-        StringBuilder sb = new StringBuilder();
-        try {
-            sb.append("\n>>dump_begin\t>>----- [EntityLockInfo] -----");
-            entityLockInfoManager.coreDump(os);
-            sb.append("\n>>dump_end\t>>----- [EntityLockInfo] -----\n");
-            os.write(sb.toString().getBytes());
-        } catch (Exception e) {
-            //ignore exception and continue dumping as much as possible.
-            if (IS_DEBUG_MODE) {
-                e.printStackTrace();
-            }
-        }
-*/
-    }
-
-    private void dumpEntityInfo(OutputStream os) {
-/*
-        StringBuilder sb = new StringBuilder();
-        try {
-            sb.append("\n>>dump_begin\t>>----- [EntityInfo] -----");
-            entityInfoManager.coreDump(os);
-            sb.append("\n>>dump_end\t>>----- [EntityInfo] -----\n");
-            os.write(sb.toString().getBytes());
-        } catch (Exception e) {
-            //ignore exception and continue dumping as much as possible.
-            if (IS_DEBUG_MODE) {
-                e.printStackTrace();
-            }
-        }
-*/
-    }
-
-    private void dumpLockWaiterInfo(OutputStream os) {
-/*
-        StringBuilder sb = new StringBuilder();
-        try {
-            sb.append("\n>>dump_begin\t>>----- [LockWaiterInfo] -----");
-            lockWaiterManager.coreDump(os);
-            sb.append("\n>>dump_end\t>>----- [LockWaiterInfo] -----\n");
-            os.write(sb.toString().getBytes());
-        } catch (Exception e) {
-            //ignore exception and continue dumping as much as possible.
-            if (IS_DEBUG_MODE) {
-                e.printStackTrace();
-            }
-        }
-*/
-    }
-
     private static class ResourceGroupTable {
         public static final int TABLE_SIZE = 10; // TODO increase
 
@@ -970,6 +833,14 @@
             int h = Math.abs(dId.getId() ^ entityHashValue);
             return table[h % TABLE_SIZE];
         }
+        
+        public StringBuilder append(StringBuilder sb) {
+            for (int i = 0; i < table.length; ++i) {
+                sb.append(i).append(" : ");
+                sb.append(table[i].firstResourceIndex).append('\n');
+            }
+            return sb;
+        }
     }
     
     private static class ResourceGroup {
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/RecordManagerTypes.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/RecordManagerTypes.java
new file mode 100644
index 0000000..5db4a89
--- /dev/null
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/RecordManagerTypes.java
@@ -0,0 +1,47 @@
+package edu.uci.ics.asterix.transaction.management.service.locking;
+
+public class RecordManagerTypes {
+    
+    public static class Byte {
+        public static StringBuilder append(StringBuilder sb, byte b) {
+            return sb.append(String.format("%1$18x", b));
+        }
+    }
+
+    public static class Short {
+        public static StringBuilder append(StringBuilder sb, short s) {
+            return sb.append(String.format("%1$18x", s));
+        }
+    }
+
+    public static class Int {
+        public static StringBuilder append(StringBuilder sb, int i) {
+            return sb.append(String.format("%1$18x", i));
+        }
+    }
+
+    public static class Global {
+
+        public static int arenaId(long l) {
+            return (int)((l >>> 48) & 0xffff);
+        }
+
+        public static int allocId(long l) {
+            return (int)((l >>> 32) & 0xffff);
+        }
+
+        public static int localId(long l) {
+            return (int) (l & 0xffffffffL);
+        }
+        
+        public static StringBuilder append(StringBuilder sb, long l) {
+            sb.append(String.format("%1$4x", RecordManagerTypes.Global.arenaId(l)));
+            sb.append(':');
+            sb.append(String.format("%1$4x", RecordManagerTypes.Global.allocId(l)));
+            sb.append(':');
+            sb.append(String.format("%1$8x", RecordManagerTypes.Global.localId(l)));
+            return sb;
+        }
+        
+    }
+}
