diff --git a/compiler/2014/C_CodeGen.jrag b/compiler/2014/C_CodeGen.jrag
index b7aae053368fb4659ec23e4d363b7bdf52c083d9..c4c934b4c30ae30844bd46f627afcac9fbca2573 100644
--- a/compiler/2014/C_CodeGen.jrag
+++ b/compiler/2014/C_CodeGen.jrag
@@ -1245,14 +1245,15 @@ aspect C_Signature {
   eq TypeDecl.C_DeclTypeString() = "LABCOMM_TYPEDEF";
 
   public void Decl.C_emitSignature(C_env env) {
-    C_emitFlatSignature(env);
-//
-//  if( false && (isReferenced() || isSampleDecl())){ 
-//    Signature signature = getSignature();
-//    signature.C_emitSignature(env, !isSampleDecl());
-//  } else {
-//    env.println("// not emitting signature for "+getName()+isReferenced()+isSampleDecl());  
-//  }
+  if( (isReferenced() || isSampleDecl())){ 
+    Signature signature = getSignature();
+    signature.C_emitSignature(env, !isSampleDecl());
+  } else {
+    env.println("// not emitting signature for "+getName()+isReferenced()+isSampleDecl());  
+  }
+  C_emitFlatSignature(env);
+
+
 //  if(env.versionHasMetaData()) { 
 //    if(isReferenced() || isSampleDecl()){
 //        env.println("(int (*)(void *))labcomm"+env.verStr+"_signature_" + 
@@ -1274,6 +1275,24 @@ aspect C_Signature {
   }
 
   public void Decl.C_emitFlatSignature(C_env env) {
+    C_emitSizeofValue(env);
+    env.println("static struct labcomm"+env.verStr+"_signature " +
+                "signature_" + env.prefix + getName() + " = {");
+    env.indent();
+    env.println("\"" + getName() + "\",");
+    //env.println("sizeof_" + env.prefix + getName() + ",");
+    //HERE BE DRAGONS? do we need sizeof for typedefs?
+    env.println("NULL,");
+    env.println("0,");
+    env.println("NULL,");
+    env.println("0,"); // index
+    env.println("sizeof(signature_tree_" + env.prefix + getName() + "),");
+    env.println("signature_tree_" + env.prefix + getName() + "");
+    env.unindent();
+    env.println(" };");
+    env.println("const struct labcomm"+env.verStr+"_signature " +
+                "*labcomm"+env.verStr+"_signature_" + env.prefix + getName() + 
+                " = &signature_" + env.prefix + getName() + ";");
   }
 
   public void SampleDecl.C_emitFlatSignature(C_env env){
@@ -1304,7 +1323,9 @@ aspect C_Signature {
     env.println("sizeof_" + env.prefix + getName() + ",");
     env.println("sizeof(signature_bytes_" + env.prefix + getName() + "),");
     env.println("signature_bytes_" + env.prefix + getName() + ",");
-    env.println("0");
+    env.println("0,"); // index
+    env.println("sizeof(signature_tree_" + env.prefix + getName() + "),");
+    env.println("signature_tree_" + env.prefix + getName() + "");
     env.unindent();
     env.println(" };");
     env.println("const struct labcomm"+env.verStr+"_signature " +
@@ -1319,28 +1340,29 @@ aspect C_Signature {
     public abstract void SignatureLine.C_emitSignature(C_env env, boolean decl);
 
     public void TypeRefSignatureLine.C_emitSignature(C_env env, boolean isDecl){ 
-      //env.print(getIndentString());
-      //env.println("LABCOMM_SIGDEF_SIGNATURE(labcomm"+env.verStr+"_signature_" + env.prefix + decl.getName() +"),");
+      env.print(getIndentString());
+    //  env.println("LABCOMM_SIGDEF_SIGNATURE(labcomm"+env.verStr+"_signature_" + env.prefix + decl.getName() +"),");
+      env.println("LABCOMM_SIGDEF_SIGNATURE(signature_" + env.prefix + decl.getName() +"),");
     }
 
     public void DataSignatureLine.C_emitSignature(C_env env, boolean decl){ 
-       //   String comment = getComment();
-       //   if (comment != null && comment.length() > 0) {
-       //     env.println(getIndentString() + "// " + comment);
-       //   }
-       //   byte[] data = getData(env.version);
-       //   if (data != null && data.length > 0) {
-       //     env.print(getIndentString());
-       //     env.print("LABCOMM_SIGDEF_BYTES("+data.length+", \"");
-       //     for (int j = 0 ; j < data.length ; j++) {
-       //       byte d = data[j];
-       //       //if(d>='a'&&d<='z' || d>='A'&&d<='Z'|| d>='0'&&d<='9'  )
-       //       //  env.print(""+(char)d);
-       //       //else
-       //       env.print("\\x"+Integer.toHexString(d));
-       //     }
-       //     env.println("\"),");
-       // }
+          String comment = getComment();
+          if (comment != null && comment.length() > 0) {
+            env.println(getIndentString() + "// " + comment);
+          }
+          byte[] data = getData(env.version);
+          if (data != null && data.length > 0) {
+            env.print(getIndentString());
+            env.print("LABCOMM_SIGDEF_BYTES("+data.length+", \"");
+            for (int j = 0 ; j < data.length ; j++) {
+              byte d = data[j];
+              //if(d>='a'&&d<='z' || d>='A'&&d<='Z'|| d>='0'&&d<='9'  )
+              //  env.print(""+(char)d);
+              //else
+              env.print("\\x"+Integer.toHexString(d));
+            }
+            env.println("\"),");
+        }
     }
 //
 //
@@ -1357,18 +1379,18 @@ aspect C_Signature {
 //
 //}
   public void SignatureList.C_emitSignature(C_env env, boolean decl) { 
-//  env.println("static struct labcomm_signature_data signature_tree_" + 
-//  	 env.prefix + parentDecl().getName() + "[] = {");
-//  env.indent();
-//  for (int i = 0 ; i < size() ; i++) {
-//    SignatureLine l = getSignatureLine(i);
-//    l.C_emitSignature(env, decl);
-//  }
-//  
-//  env.println("LABCOMM_SIGDEF_END");
-//  env.println("};");
-//  env.unindent();
-//  env.println();
+  env.println("static struct labcomm_signature_data signature_tree_" + 
+  	 env.prefix + parentDecl().getName() + "[] = {");
+  env.indent();
+  for (int i = 0 ; i < size() ; i++) {
+    SignatureLine l = getSignatureLine(i);
+    l.C_emitSignature(env, decl);
+  }
+  
+  env.println("LABCOMM_SIGDEF_END");
+  env.println("};");
+  env.unindent();
+  env.println();
   }
 
 
diff --git a/lib/c/2014/labcomm.h b/lib/c/2014/labcomm.h
index 4bc6b6cb881f3a16be1780d97adbdeb972dee73c..5499184b90abf2e49ac392d6bde9b40015d274e5 100644
--- a/lib/c/2014/labcomm.h
+++ b/lib/c/2014/labcomm.h
@@ -42,17 +42,57 @@ struct labcomm_decoder;
 /*
  * Signature entry
  */
+#ifndef LABCOMM_NO_TYPEDECL
+#ifdef USE_UNIONS
+
+/* Useful for C99 and up (or GCC without -pedantic) */ 
+
+#define LABCOMM_SIGDEF_BYTES_OR_SIGNATURE          \
+  union {                                   \
+    char *bytes;                            \
+    struct labcomm_signature* signature;            \
+  } u;
+
+#define LABCOMM_SIGDEF_BYTES(l, b) { l, .u.bytes=b }
+#define LABCOMM_SIGDEF_SIGNATURE(s) { 0, .u.signature=&s } // addressof, as s is pointing at the sig struct, not directly the the sig_bytes[]
+#define LABCOMM_SIGDEF_END { -1, .u.bytes=0 }
+
+#else
+
+#define LABCOMM_SIGDEF_BYTES_OR_SIGNATURE          \
+  struct {                                  \
+    char *bytes;                            \
+    const struct labcomm_signature *signature;            \
+  } u;
+
+#define LABCOMM_SIGDEF_BYTES(l, b) { l, { b, 0 } }
+#define LABCOMM_SIGDEF_SIGNATURE(s) { 0, { 0, &s } }
+#define LABCOMM_SIGDEF_END { -1, { 0, 0 } }
+
+#endif
+
+struct labcomm_signature_data {
+  int length;
+  LABCOMM_SIGDEF_BYTES_OR_SIGNATURE
+};
+
+#endif
 struct labcomm_signature {
   char *name;
   int (*encoded_size)(void *); /* void* refers to sample_data */
   int size;
   unsigned char *signature; 
   int index;
+#ifndef LABCOMM_NO_TYPEDECL
+  int tdsize;
+  struct labcomm_signature_data *treedata;
+#endif  
 #ifdef LABCOMM_EXPERIMENTAL_CACHED_ENCODED_SIZE
   int cached_encoded_size; // -1 if not initialized or type is variable size
 #endif
 };
 
+#include "labcomm_type_signature.h"
 /*
  * Error handling.
  */