diff --git a/SConscript b/SConscript
index afa8168e893ec3b7c765168429fb49dfd4cc094b..dcc857aa9045846494dd9e75e077e53e3a263bed 100644
--- a/SConscript
+++ b/SConscript
@@ -21,10 +21,10 @@ if env.GetOption('clean'):
 else:
 
     # check/install targ-config.h
-    if not os.path.isfile(os.environ['SECURITY_TRANSFORMS_HOME']+"/include/targ-config.h"):
-	#print "uname=", sysname, " xx ", nodename, " xx ", release, " xx ", version, " xx ", machine
-	shutil.copy( os.path.join(os.environ['SECURITY_TRANSFORMS_HOME'],"include",machine,"config.h"), 
-		     os.path.join(os.environ['SECURITY_TRANSFORMS_HOME'],"include","targ-config.h"))
+    #if not os.path.isfile(os.environ['SECURITY_TRANSFORMS_HOME']+"/include/targ-config.h"):
+	##print "uname=", sysname, " xx ", nodename, " xx ", release, " xx ", version, " xx ", machine
+	#shutil.copy( os.path.join(os.environ['SECURITY_TRANSFORMS_HOME'],"include",machine,"config.h"), 
+		     #os.path.join(os.environ['SECURITY_TRANSFORMS_HOME'],"include","targ-config.h"))
 
     os.chdir(os.environ['SECURITY_TRANSFORMS_HOME']+"/libcapstone")
     print "Rebuilding libcapstone."
@@ -40,9 +40,10 @@ else:
 
 
 
-pedi = Command( target = "./testoutput",
-		source = "./SConscript",
-                action = os.environ['PEDI_HOME']+"/pedi -m manifest.txt " )
+if "PEDI_HOME" in os.environ:
+	pedi = Command( target = "./testoutput",
+			source = "./SConscript",
+			action = os.environ['PEDI_HOME']+"/pedi -m manifest.txt " )
 
 env['BASE_IRDB_LIBS']="IRDB-core", "pqxx", "pq", "EXEIO"
 
@@ -50,7 +51,8 @@ if sysname != "SunOS":
 	libPEBLISS=SConscript("pebliss/trunk/pe_lib/SConscript", variant_dir='scons_build/libPEBLISS')
 	# setup libraries needed for linking
 	env['BASE_IRDB_LIBS']=env['BASE_IRDB_LIBS']+("pebliss",)
-	Depends(pedi,libPEBLISS)
+	if "PEDI_HOME" in os.environ:
+		Depends(pedi,libPEBLISS)
 
 # pebliss requires iconv, which needs to be explicit on cygwin.
 if "CYGWIN" in sysname:
@@ -69,19 +71,29 @@ libtransform=SConscript("libtransform/SConscript", variant_dir='scons_build/libt
 libEXEIO=SConscript("libEXEIO/SConscript", variant_dir='scons_build/libEXEIO')
 #libbea=SConscript("beaengine/SConscript", variant_dir='scons_build/beaengine')
 libMEDSannotation=SConscript("libMEDSannotation/SConscript", variant_dir='scons_build/libMEDSannotation')
-libxform=SConscript("xform/SConscript", variant_dir='scons_build/libxform')
+# libxform=SConscript("xform/SConscript", variant_dir='scons_build/libxform')
 libIRDB=SConscript("libIRDB/SConscript", variant_dir='scons_build/libIRDB')
 Depends(libIRDB,libcapstone)
 libStructDiv=SConscript("libStructDiv/SConscript", variant_dir='scons_build/libStructDiv')
 libElfDep=SConscript("libElfDep/SConscript", variant_dir='scons_build/libElfDep')
+thanos=SConscript("thanos/SConscript", variant_dir='scons_build/thanos')
+rida=SConscript("rida/SConscript", variant_dir='scons_build/rida')
+meds2pdb=SConscript("meds2pdb/SConscript", variant_dir='scons_build/meds2pdb')
+dump_map=SConscript("dump_map/SConscript", variant_dir='scons_build/dump_map')
+dump_insns=SConscript("dump_insns/SConscript", variant_dir='scons_build/dump_insns')
 
 
-Depends(pedi, (libehp,libtransform,libEXEIO,libMEDSannotation,libxform,libIRDB,libStructDiv,libElfDep, libcapstone))
-
 tools=None
 if 'build_tools' not in env or env['build_tools'] is None or int(env['build_tools']) == 1:
 	tools=SConscript("tools/SConscript", variant_dir='scons_build/tools')
-	Depends(pedi,tools)
+	if "PEDI_HOME" in os.environ:
+		Depends(pedi,tools)
 
-Default( pedi )
+if "PEDI_HOME" in os.environ:
+	Depends(pedi, (libehp,libtransform,libEXEIO,libMEDSannotation,libIRDB,libStructDiv,libElfDep, libcapstone, thanos, rida, meds2pdb, dump_map, dump_insns))
+	Default( pedi )
+else:
 
+	Default(libehp,libtransform,libEXEIO,libMEDSannotation,libIRDB,libStructDiv,libElfDep, libcapstone, thanos, rida, meds2pdb, dump_map, dump_insns)
+	if 'build_tools' not in env or env['build_tools'] is None or int(env['build_tools']) == 1:
+		Default(tools)
diff --git a/SConstruct b/SConstruct
index 0aebd26be2fc36817236fea21f095712beb6d0a9..d678c73e227bca8176ee0f1e05b4b8f7f54de247 100644
--- a/SConstruct
+++ b/SConstruct
@@ -15,8 +15,9 @@ env.Replace(LINKFLAGS="-fPIC -fmax-errors=2 -Wall -Werror -fmax-errors=2 ")
 
 # parse arguments
 env.Replace(SECURITY_TRANSFORMS_HOME=os.environ['SECURITY_TRANSFORMS_HOME'])
-env.Replace(PEDI_HOME=os.environ['PEDI_HOME'])
-env.Replace(SMPSA_HOME=os.environ['SMPSA_HOME'])
+if 'PEDI_HOME' in os.environ:
+	env.Replace(PEDI_HOME=os.environ['PEDI_HOME'])
+#env.Replace(SMPSA_HOME=os.environ['SMPSA_HOME'])
 env.Replace(do_64bit_build=ARGUMENTS.get("do_64bit_build",None))
 env.Replace(debug=ARGUMENTS.get("debug",0))
 env.Replace(build_appfw=ARGUMENTS.get("build_appfw", 0))
diff --git a/tools/dump_insns/Makefile.in b/dump_insns/Makefile.in
similarity index 100%
rename from tools/dump_insns/Makefile.in
rename to dump_insns/Makefile.in
diff --git a/tools/dump_insns/SConscript b/dump_insns/SConscript
similarity index 100%
rename from tools/dump_insns/SConscript
rename to dump_insns/SConscript
diff --git a/tools/dump_insns/SConstruct b/dump_insns/SConstruct
similarity index 100%
rename from tools/dump_insns/SConstruct
rename to dump_insns/SConstruct
diff --git a/tools/dump_insns/dump_insns.cpp b/dump_insns/dump_insns.cpp
similarity index 100%
rename from tools/dump_insns/dump_insns.cpp
rename to dump_insns/dump_insns.cpp
diff --git a/tools/dump_map/Makefile.in b/dump_map/Makefile.in
similarity index 100%
rename from tools/dump_map/Makefile.in
rename to dump_map/Makefile.in
diff --git a/tools/dump_map/SConscript b/dump_map/SConscript
similarity index 100%
rename from tools/dump_map/SConscript
rename to dump_map/SConscript
diff --git a/tools/dump_map/SConstruct b/dump_map/SConstruct
similarity index 100%
rename from tools/dump_map/SConstruct
rename to dump_map/SConstruct
diff --git a/tools/dump_map/dump_map.cpp b/dump_map/dump_map.cpp
similarity index 100%
rename from tools/dump_map/dump_map.cpp
rename to dump_map/dump_map.cpp
diff --git a/libIRDB/include/libIRDB-core.hpp b/libIRDB/include/libIRDB-core.hpp
index 96d47e3053cbafb5bcbb0cebfd4b46e5039ea684..5c094076862d10fcc1c961b8b1b2821a8d650200 100644
--- a/libIRDB/include/libIRDB-core.hpp
+++ b/libIRDB/include/libIRDB-core.hpp
@@ -44,7 +44,6 @@ class Instruction_t; // forward decl for many classes
 #include <core/baseobj.hpp>
 #include <core/reloc.hpp>
 #include <core/address.hpp>
-// xxx #include <core/instructioncfg.hpp>
 #include <core/icfs.hpp>
 #include <core/instruction.hpp>
 #include <core/file.hpp>
diff --git a/libIRDB/test/SConscript b/libIRDB/test/SConscript
index d8fc3821b010fdfd86034849ce6ea7f6f0ddc6a8..170d80f84abf69a15367c96fa318cf7294d54fdb 100644
--- a/libIRDB/test/SConscript
+++ b/libIRDB/test/SConscript
@@ -46,10 +46,6 @@ if 'build_tools' not in myenv or myenv['build_tools'] is None or int(myenv['buil
 
 	# most programs go to $sectrans/bin
 	pgms='''clone 
-		generate_spri 
-		find_strings 
-		mark_functions_safe
-		decode_test
 		'''
 	for i in Split(pgms):
 		# print "Registering pgm: "+ i
diff --git a/tools/meds2pdb/SConscript b/meds2pdb/SConscript
similarity index 91%
rename from tools/meds2pdb/SConscript
rename to meds2pdb/SConscript
index 5869a82157de1c8d0bef4bd845b3a28c4aa2c68c..241010ac04fcec4d613cc4f62a253556e60d47c0 100644
--- a/tools/meds2pdb/SConscript
+++ b/meds2pdb/SConscript
@@ -15,7 +15,7 @@ cpppath='''
 	 $SECURITY_TRANSFORMS_HOME/libtransform/include
 	'''
 
-files=Glob( Dir('.').srcnode().abspath+"/*.cpp")
+files=Glob( Dir('.').srcnode().abspath+"/*.cpp") + Glob(Dir('.').srcnode().abspath+"/*.c")
 
 
 pgm="meds2pdb"
diff --git a/tools/meds2pdb/SConstruct b/meds2pdb/SConstruct
similarity index 100%
rename from tools/meds2pdb/SConstruct
rename to meds2pdb/SConstruct
diff --git a/xform/aspri.h b/meds2pdb/aspri.h
similarity index 96%
rename from xform/aspri.h
rename to meds2pdb/aspri.h
index 70cc78ce27d4923d4d95c26b09b7001c43e7321e..54a974552794d461434f066c9d612cfde455a44a 100644
--- a/xform/aspri.h
+++ b/meds2pdb/aspri.h
@@ -34,7 +34,7 @@ typedef struct aspri_address aspri_address_t;
 struct aspri_address
 {
 	char *library_name;
-	app_iaddr_t offset;
+	libIRDB::virtual_offset_t offset;
 	bool isCurrentPC;
 };
 
diff --git a/xform/bitvector.c b/meds2pdb/bitvector.cpp
similarity index 92%
rename from xform/bitvector.c
rename to meds2pdb/bitvector.cpp
index 9660878fbf8104821f0f5c50028569254284021a..e3c627724516c9570e1b49a364595222cbac4fe8 100644
--- a/xform/bitvector.c
+++ b/meds2pdb/bitvector.cpp
@@ -28,7 +28,7 @@
  */
 
 
-#include "all.h"
+#include "meds_all.h"
 
 
 /* 
@@ -40,13 +40,13 @@ bitvector_t * allocate_bitvector(int num_fields, int num_data_chunks)
 	/* round number of bits up to 8 then convert to bytes */
 	int num_bytes_to_allocate=(((num_fields*num_data_chunks) + 7) &~7)/8;
 
-	bitvector_t * the_bitvector = spri_allocate_type(sizeof(bitvector_t));
+	bitvector_t * the_bitvector = (bitvector_t*)spri_allocate_type(sizeof(bitvector_t));
 	/* allocate the_bits 
 	 *  	the number of bits needed is num_fields * num_data_chunks 
 	 * 	rounded to nearest 8 (num bits in a char)
 	 * 	to get bytes, need to divide by 8 bits
  	 */
-	the_bitvector->the_bits = spri_allocate_type(num_bytes_to_allocate*sizeof(char));
+	the_bitvector->the_bits = (char*)spri_allocate_type(num_bytes_to_allocate*sizeof(char));
 	the_bitvector->size = num_fields*num_data_chunks;
 	the_bitvector->num_bytes = num_bytes_to_allocate;
 
@@ -57,7 +57,7 @@ bitvector_t * allocate_bitvector(int num_fields, int num_data_chunks)
 void free_bitvector(bitvector_t *the_bitvector_to_be_freed)
 {
 #ifndef NDEBUG
-	STRATA_LOG("profile_fields_allocate","bitvector address:  0x%x size: %d\n", the_bitvector_to_be_freed, the_bitvector_to_be_freed->size);
+// 	STRATA_LOG("profile_fields_allocate","bitvector address:  0x%x size: %d\n", the_bitvector_to_be_freed, the_bitvector_to_be_freed->size);
 #endif
 	/* first free the_bits vector */
 	spri_deallocate_type((void *)the_bitvector_to_be_freed->the_bits, ((the_bitvector_to_be_freed->size+7)&~7)/8);
diff --git a/xform/bitvector.h b/meds2pdb/bitvector.h
similarity index 100%
rename from xform/bitvector.h
rename to meds2pdb/bitvector.h
diff --git a/xform/constant_hash.c b/meds2pdb/constant_hash.cpp
similarity index 88%
rename from xform/constant_hash.c
rename to meds2pdb/constant_hash.cpp
index 9b4b210cfa78f08089a5e11e07c065b202845b2d..048158196bf6b72476db86b51cff697101d3fd5a 100644
--- a/xform/constant_hash.c
+++ b/meds2pdb/constant_hash.cpp
@@ -21,7 +21,7 @@
  *
  */
 
-#include "all.h"
+#include "meds_all.h"
 
 Hashtable *constants_hash=NULL;
 
@@ -48,7 +48,7 @@ long constants_key_compare(void* key1, void* key2)
 }
 
 
-constant_hash_value_t * add_constant_ref(app_iaddr_t pc,int the_const, constant_hash_field_t the_field, constant_hash_type_t the_type)
+constant_hash_value_t * add_constant_ref(libIRDB::virtual_offset_t pc,int the_const, constant_hash_field_t the_field, constant_hash_type_t the_type)
 {
         constant_hash_key_t *chk=(constant_hash_key_t*)spri_allocate_type(sizeof(constant_hash_key_t ));
         constant_hash_value_t *chv=(constant_hash_value_t*)spri_allocate_type(sizeof(constant_hash_value_t ));
@@ -60,10 +60,11 @@ constant_hash_value_t * add_constant_ref(app_iaddr_t pc,int the_const, constant_
         chv->type=the_type;
 
         Hashtable_put(constants_hash, chk, chv);
+	return chv;
 
 }
 
-constant_hash_value_t * get_constant_ref(app_iaddr_t pc, int the_const, constant_hash_field_t the_field)
+constant_hash_value_t * get_constant_ref(libIRDB::virtual_offset_t pc, int the_const, constant_hash_field_t the_field)
 {
 	constant_hash_key_t chk={pc, the_const, the_field};
 	constant_hash_value_t *chv=(constant_hash_value_t*)Hashtable_get(constants_hash, &chk);
diff --git a/xform/constant_hash.h b/meds2pdb/constant_hash.h
similarity index 84%
rename from xform/constant_hash.h
rename to meds2pdb/constant_hash.h
index b439b9f860f3ff24950059dc53b15ff1e51c1729..422496b0eb8ce45e068c1f548b1e1c6062803b7e 100644
--- a/xform/constant_hash.h
+++ b/meds2pdb/constant_hash.h
@@ -33,7 +33,7 @@ typedef enum constant_hash_field constant_hash_field_t;
 extern Hashtable *constants_hash;
 struct constant_hash_key
 {
-        app_iaddr_t pc;
+        libIRDB::virtual_offset_t pc;
         int the_const;
 	constant_hash_field_t field;
 };
@@ -49,9 +49,9 @@ long constants_compute_hash(void* key1);
 
 long constants_key_compare(void* key1, void* key2);
 
-constant_hash_value_t * add_constant_ref(app_iaddr_t pc,int the_const, constant_hash_field_t the_field, constant_hash_type_t the_type);
+constant_hash_value_t * add_constant_ref(libIRDB::virtual_offset_t pc,int the_const, constant_hash_field_t the_field, constant_hash_type_t the_type);
 
-constant_hash_value_t * get_constant_ref(app_iaddr_t pc, int the_const, constant_hash_field_t the_field);
+constant_hash_value_t * get_constant_ref(libIRDB::virtual_offset_t pc, int the_const, constant_hash_field_t the_field);
 
 const char* constant_hash_type_to_string(constant_hash_type_t type);
 
diff --git a/xform/elfreader.cpp b/meds2pdb/elfreader.cpp
similarity index 92%
rename from xform/elfreader.cpp
rename to meds2pdb/elfreader.cpp
index 0f748e1a59dfad86e3a05d1499c69f71a17d6c69..18f6827093eb9a62f9e938eca8aae868dc56fdc6 100644
--- a/xform/elfreader.cpp
+++ b/meds2pdb/elfreader.cpp
@@ -20,15 +20,8 @@
 
 #include <iostream>
 #include <string.h>
-#include "targ-config.h"
-
 #include <stdio.h>
-
-/*
-#include "elfio/elfio.hpp"
-#include "elfio/elfio_dump.hpp"
-
-*/
+#include <libIRDB-core.hpp>
 #include "elfreader.h"
 
 using namespace std;
@@ -86,7 +79,7 @@ ElfReader::~ElfReader()
 /*
 * Read <p_numBytes> from ELF file for location <p_pc>
 */
-string ElfReader::read(app_iaddr_t p_pc, unsigned p_numBytes) const
+string ElfReader::read(libIRDB::virtual_offset_t p_pc, unsigned p_numBytes) const
 {
   for ( int i = 0; i < m_reader->sections.size(); ++i ) 
   {    
@@ -109,7 +102,7 @@ string ElfReader::read(app_iaddr_t p_pc, unsigned p_numBytes) const
 * No bounds checking is done on <p_buf>
 * Return false if address not in valid sections
 */
-bool ElfReader::read(app_iaddr_t p_pc, unsigned p_numBytes, char* p_buf) const
+bool ElfReader::read(libIRDB::virtual_offset_t p_pc, unsigned p_numBytes, char* p_buf) const
 {
   for ( int i = 0; i < m_reader->sections.size(); ++i ) 
   {    
@@ -130,7 +123,7 @@ bool ElfReader::read(app_iaddr_t p_pc, unsigned p_numBytes, char* p_buf) const
 /*
 * Return buffer for instruction off the ELF file
 */
-const char* ElfReader::getInstructionBuffer(app_iaddr_t p_pc) const
+const char* ElfReader::getInstructionBuffer(libIRDB::virtual_offset_t p_pc) const
 {
   for ( int i = 0; i < m_reader->sections.size(); ++i ) 
   {    
diff --git a/xform/elfreader.h b/meds2pdb/elfreader.h
similarity index 82%
rename from xform/elfreader.h
rename to meds2pdb/elfreader.h
index 20e1edf1350d7c2c03a65d6e04a43608dfd50214..3eed1be6de0d943f28746aa8f49338a9c714d6dc 100644
--- a/xform/elfreader.h
+++ b/meds2pdb/elfreader.h
@@ -3,7 +3,7 @@
 
 #include <vector>
 #include "exeio.h"
-#include "targ-config.h"
+#include <libIRDB-core.hpp>
 #include <assert.h>
 #include <exception>
 #include <libIRDB-core.hpp>
@@ -20,9 +20,9 @@ class ElfReader
 	ElfReader(char *);
 	virtual ~ElfReader();
 
-	std::string read(app_iaddr_t p_pc, unsigned p_numBytes) const ;
-	bool read(app_iaddr_t p_pc, unsigned p_numBytes, char* p_buf) const ;
-	const char* getInstructionBuffer(app_iaddr_t p_pc) const ;
+	std::string read(libIRDB::virtual_offset_t p_pc, unsigned p_numBytes) const ;
+	bool read(libIRDB::virtual_offset_t p_pc, unsigned p_numBytes, char* p_buf) const ;
+	const char* getInstructionBuffer(libIRDB::virtual_offset_t p_pc) const ;
 
 	bool isElf32() const { assert(m_reader); return m_reader->get_class()==EXEIO::ELF32; }
 	bool isElf64() const { assert(m_reader); return m_reader->get_class()==EXEIO::ELF64; }
diff --git a/xform/framerestore_hash.c b/meds2pdb/framerestore_hash.cpp
similarity index 92%
rename from xform/framerestore_hash.c
rename to meds2pdb/framerestore_hash.cpp
index 5c3ef8960afe583cf84680317f8b0635b13a3258..adf972ab8bddd244c61ee4c3a3491e9299bd83cc 100644
--- a/xform/framerestore_hash.c
+++ b/meds2pdb/framerestore_hash.cpp
@@ -45,7 +45,7 @@ long framerestores_key_compare(void* key1, void* key2)
 /*
  * frame_restore_set_return_address - set the offset of the return address for this frame
  */
-void frame_restore_set_return_address(app_iaddr_t pc, int offset)
+void frame_restore_set_return_address(libIRDB::virtual_offset_t pc, int offset)
 {
 	instrmap_hash_value_t *imhv=(instrmap_hash_value_t*)Hashtable_get(instrmaps_hash,&pc);
 
@@ -75,7 +75,7 @@ void frame_restore_set_return_address(app_iaddr_t pc, int offset)
 /* 
  * frame_restore_hash_add_reg_restore - add info to the frame restore hash about the type and offset of saved registers
  */
-void frame_restore_hash_add_reg_restore(app_iaddr_t addr, int reg_num, int reg_offset, int reg_type)
+void frame_restore_hash_add_reg_restore(libIRDB::virtual_offset_t addr, int reg_num, int reg_offset, int reg_type)
 {
 
         framerestore_hash_value_t *frhv=(framerestore_hash_value_t*) Hashtable_get(framerestores_hash,&addr);
@@ -104,7 +104,7 @@ void frame_restore_hash_add_reg_restore(app_iaddr_t addr, int reg_num, int reg_o
 }
 
 
-void frame_restore_hash_set_safe_bit(app_iaddr_t addr, int is_safe)
+void frame_restore_hash_set_safe_bit(libIRDB::virtual_offset_t addr, int is_safe)
 {
 
         framerestore_hash_value_t *frhv=(framerestore_hash_value_t*)Hashtable_get(framerestores_hash,&addr);
@@ -126,7 +126,7 @@ void frame_restore_hash_set_safe_bit(app_iaddr_t addr, int is_safe)
         frhv->static_analyzer_believes_safe=is_safe;
 }
 
-int is_safe_function(app_iaddr_t pc)
+int is_safe_function(libIRDB::virtual_offset_t pc)
 {
 	instrmap_hash_value_t *imhv=(instrmap_hash_value_t*)Hashtable_get(instrmaps_hash,&pc);
 
diff --git a/xform/framerestore_hash.h b/meds2pdb/framerestore_hash.h
similarity index 79%
rename from xform/framerestore_hash.h
rename to meds2pdb/framerestore_hash.h
index b6caf515c6c29fbf9aec1f4c663ecf4cd13746de..72edda0e645e8bcb4ba53205f81db03333eb49a8 100644
--- a/xform/framerestore_hash.h
+++ b/meds2pdb/framerestore_hash.h
@@ -24,7 +24,7 @@
 #ifndef framerestore_hash_h
 #define framerestore_hash_h
 
-#include "all.h"
+#include "meds_all.h"
 
 
 extern Hashtable *framerestores_hash;
@@ -50,12 +50,12 @@ long framerestores_compute_hash(void* key1);
 
 long framerestores_key_compare(void* key1, void* key2);
 
-void frame_restore_hash_add_reg_restore(app_iaddr_t addr, int reg_num, int reg_offset, int reg_type);
+void frame_restore_hash_add_reg_restore(libIRDB::virtual_offset_t addr, int reg_num, int reg_offset, int reg_type);
 
-void frame_restore_hash_set_safe_bit(app_iaddr_t addr, int is_safe);
+void frame_restore_hash_set_safe_bit(libIRDB::virtual_offset_t addr, int is_safe);
 
-void frame_restore_hash_set_frame_size(app_iaddr_t addr, int is_safe);
-void frame_restore_set_return_address(app_iaddr_t pc, int offset);
+void frame_restore_hash_set_frame_size(libIRDB::virtual_offset_t addr, int is_safe);
+void frame_restore_set_return_address(libIRDB::virtual_offset_t pc, int offset);
 
 
 #endif
diff --git a/xform/framesize_hash.c b/meds2pdb/framesize_hash.cpp
similarity index 67%
rename from xform/framesize_hash.c
rename to meds2pdb/framesize_hash.cpp
index b8b0c8069af628bebd6c8bceda5307c0ea388378..e6f3a8de4c64fdf4bdcdaabe32cb9502f1286f5a 100644
--- a/xform/framesize_hash.c
+++ b/meds2pdb/framesize_hash.cpp
@@ -17,10 +17,10 @@ long framesizes_key_compare(void* key1, void* key2)
         return a_key->pc == b_key->pc;
 }
 
-int set_frame_size(int pc, int frame_size)
+void set_frame_size(int pc, int frame_size)
 {
 	framesize_hash_key_t fshk={pc};
-	framesize_hash_value_t *fshv=Hashtable_get(framesizes_hash, &fshk);
+	framesize_hash_value_t *fshv=(framesize_hash_value_t*)Hashtable_get(framesizes_hash, &fshk);
 
 	if(fshv)
 	{
@@ -31,8 +31,8 @@ int set_frame_size(int pc, int frame_size)
 		return;
 	}
 
-	framesize_hash_key_t *fshk2=spri_allocate_type(sizeof(*fshk2));
-	framesize_hash_value_t *fshv2=spri_allocate_type(sizeof(*fshv2));
+	framesize_hash_key_t *fshk2=(framesize_hash_key_t*)spri_allocate_type(sizeof(*fshk2));
+	framesize_hash_value_t *fshv2=(framesize_hash_value_t*)spri_allocate_type(sizeof(*fshv2));
 
 	*fshk2=fshk;
 	fshv2->frame_size=frame_size;
@@ -46,7 +46,7 @@ int set_frame_size(int pc, int frame_size)
 int is_var_sized_frame(int pc)
 {
 	framesize_hash_key_t fshk={pc};
-	framesize_hash_value_t *fshv=Hashtable_get(framesizes_hash, &fshk);
+	framesize_hash_value_t *fshv=(framesize_hash_value_t*)Hashtable_get(framesizes_hash, &fshk);
 
 	if(fshv)
 	{
diff --git a/xform/framesize_hash.h b/meds2pdb/framesize_hash.h
similarity index 87%
rename from xform/framesize_hash.h
rename to meds2pdb/framesize_hash.h
index 4a2af6206ddceaa513107b02a07388282096b7a9..a379e485217426b6ed8c38c6a578fc8d6fec67ac 100644
--- a/xform/framesize_hash.h
+++ b/meds2pdb/framesize_hash.h
@@ -1,7 +1,7 @@
 #ifndef framesize_hash_h
 #define framesize_hash_h
 
-#include "all.h"
+#include "meds_all.h"
 
 
 extern Hashtable *framesizes_hash;
@@ -22,7 +22,7 @@ long framesizes_compute_hash(void* key1);
 
 long framesizes_key_compare(void* key1, void* key2);
 
-int set_frame_size(int pc, int frame_size);
+void set_frame_size(int pc, int frame_size);
 int is_var_sized_frame(int pc);
 
 
diff --git a/xform/funclist_hash.c b/meds2pdb/funclist_hash.cpp
similarity index 100%
rename from xform/funclist_hash.c
rename to meds2pdb/funclist_hash.cpp
diff --git a/xform/funclist_hash.h b/meds2pdb/funclist_hash.h
similarity index 98%
rename from xform/funclist_hash.h
rename to meds2pdb/funclist_hash.h
index 52d3f416bb8dc5dec6a62b7ddcf619b5e79fc634..7e3f618e398120c2850bb46be237d09c74f65baa 100644
--- a/xform/funclist_hash.h
+++ b/meds2pdb/funclist_hash.h
@@ -24,7 +24,7 @@
 #ifndef funclist_hash_h
 #define funclist_hash_h
 
-#include "all.h"
+#include "meds_all.h"
 
 
 extern Hashtable *funclists_hash;
diff --git a/xform/function_descriptor.cpp b/meds2pdb/function_descriptor.cpp
similarity index 90%
rename from xform/function_descriptor.cpp
rename to meds2pdb/function_descriptor.cpp
index c2dec6d5c6cdc050548262db9e26936be661f18e..6177d0945d80298fe60e99290606c379de9563ac 100644
--- a/xform/function_descriptor.cpp
+++ b/meds2pdb/function_descriptor.cpp
@@ -40,13 +40,13 @@ wahoo::Function::Function()
   _init();
 }
 
-wahoo::Function::Function(app_iaddr_t p_start)
+wahoo::Function::Function(libIRDB::virtual_offset_t p_start)
 {
   _init();
   setAddress(p_start);
 }
 
-wahoo::Function::Function(string p_name, app_iaddr_t p_start, int p_size)
+wahoo::Function::Function(string p_name, libIRDB::virtual_offset_t p_start, int p_size)
 {
   _init();
   setName(p_name);
@@ -63,7 +63,7 @@ bool wahoo::Function::operator == (const Function &other)
   return (other.m_name == this->m_name && other.m_address == this->m_address);
 }
 
-bool wahoo::Function::operator == (const app_iaddr_t p_addr)
+bool wahoo::Function::operator == (const libIRDB::virtual_offset_t p_addr)
 {
   return (this->m_address == p_addr);
 }
@@ -73,7 +73,7 @@ bool wahoo::Function::operator != (const Function &other)
   return (other.m_name != this->m_name || other.m_address != this->m_address);
 }
 
-bool wahoo::Function::operator != (const app_iaddr_t p_addr)
+bool wahoo::Function::operator != (const libIRDB::virtual_offset_t p_addr)
 {
   return (this->m_address != p_addr);
 }
diff --git a/xform/function_descriptor.h b/meds2pdb/function_descriptor.h
similarity index 64%
rename from xform/function_descriptor.h
rename to meds2pdb/function_descriptor.h
index 32b4c429feffb0bf7e0b3f145d321fd0c177b8a2..51ce72bd8f5b4ca6fa1ad183b07e6a12d566ddaf 100644
--- a/xform/function_descriptor.h
+++ b/meds2pdb/function_descriptor.h
@@ -2,7 +2,8 @@
 #include <vector>
 #include <string>
 
-#include "targ-config.h"
+#include <libIRDB-core.hpp>
+#include <libIRDB-core.hpp>
 #include "instruction_descriptor.h"
 
 //class wahoo::Instruction;
@@ -15,26 +16,26 @@ class Function
 {
   public:
     Function();
-    Function(app_iaddr_t);
-    Function(string, app_iaddr_t, int);
+    Function(libIRDB::virtual_offset_t);
+    Function(string, libIRDB::virtual_offset_t, int);
     ~Function();
 
-    string            getName() const { return m_name; }
-    void              setName(const string p_name) { m_name = p_name; }
-    app_iaddr_t       getAddress() const { return m_address; }
-    void              setAddress(const app_iaddr_t p_address) { m_address = p_address; }
-    int               getSize() const { return m_size; }
-    void              setSize(const int p_size) { m_size = p_size; }
-    int               getFrameSize() const { return m_frameSize; }
-    void              setFrameSize(const int p_size) { m_frameSize = p_size; }
-    int               getFunctionID() const { return m_functionID; }
-    void              setFunctionID(const int id) { m_functionID = id; }
+    string                    getName() const { return m_name; }
+    void                      setName(const string p_name) { m_name = p_name; }
+    libIRDB::virtual_offset_t getAddress() const { return m_address; }
+    void                      setAddress(const libIRDB::virtual_offset_t p_address) { m_address = p_address; }
+    int                       getSize() const { return m_size; }
+    void                      setSize(const int p_size) { m_size = p_size; }
+    int                       getFrameSize() const { return m_frameSize; }
+    void                      setFrameSize(const int p_size) { m_frameSize = p_size; }
+    int                       getFunctionID() const { return m_functionID; }
+    void                      setFunctionID(const int id) { m_functionID = id; }
 
 	
     bool operator == (const Function &);
-    bool operator == (const app_iaddr_t);
+    bool operator == (const libIRDB::virtual_offset_t);
     bool operator != (const Function &);
-    bool operator != (const app_iaddr_t);
+    bool operator != (const libIRDB::virtual_offset_t);
 
     bool isSafe() const { return m_isSafe; }
     void setSafe() { m_isSafe = true; }
@@ -67,7 +68,7 @@ class Function
 
     int            m_functionID;
     string         m_name;
-    app_iaddr_t    m_address;
+    libIRDB::virtual_offset_t    m_address;
     int            m_size;
     int            m_frameSize;
     bool           m_isSafe;
diff --git a/xform/gen_hash.c b/meds2pdb/gen_hash.cpp
similarity index 98%
rename from xform/gen_hash.c
rename to meds2pdb/gen_hash.cpp
index 1b1c9d885d9f066a01188d266af86634ce93ec94..358bc720969e11ff30bdc90e00b9399ac41c655b 100644
--- a/xform/gen_hash.c
+++ b/meds2pdb/gen_hash.cpp
@@ -111,7 +111,7 @@ void Hashtable_rehash( Hashtable *h )
 void Hashtable_put( Hashtable *h, void *key, void *value )
 {
     struct entry *e;
-    long hash = (long)key;
+    // long hash = (long)key;
     long index = h->hash_func(key) & (h->tableLength-1);
 
     // make sure the key isn't already present
@@ -195,7 +195,7 @@ struct entry* Hashtable_get_next(Hashtable_iterator &iterator)
 
     if (iterator.idx < 0)
     {
-      int i;
+      int i=0;
       // first time, find the first real entry
       for (i = 0; i < iterator.ht->tableLength; ++i)
       {
@@ -220,7 +220,7 @@ struct entry* Hashtable_get_next(Hashtable_iterator &iterator)
             }
             else
             {
-                int i;
+                int i=0;
                 // get the next entry
                 for (i = iterator.idx + 1; i < iterator.ht->tableLength; ++i)
                 {
@@ -234,6 +234,7 @@ struct entry* Hashtable_get_next(Hashtable_iterator &iterator)
                 return NULL; // we're done
             }
         }
+        return NULL; // empty table, no keys found
     } 
 } 
 
diff --git a/xform/gen_hash.h b/meds2pdb/gen_hash.h
similarity index 100%
rename from xform/gen_hash.h
rename to meds2pdb/gen_hash.h
diff --git a/xform/instrmap_hash.c b/meds2pdb/instrmap_hash.cpp
similarity index 100%
rename from xform/instrmap_hash.c
rename to meds2pdb/instrmap_hash.cpp
diff --git a/xform/instrmap_hash.h b/meds2pdb/instrmap_hash.h
similarity index 98%
rename from xform/instrmap_hash.h
rename to meds2pdb/instrmap_hash.h
index 8b802fcb8c57469d0c3f51a70626d0c1e8a7e46e..1b6239596186a4c99fb3c9a99e39f25c8b0738c0 100644
--- a/xform/instrmap_hash.h
+++ b/meds2pdb/instrmap_hash.h
@@ -24,7 +24,7 @@
 #ifndef instrmap_hash_h
 #define instrmap_hash_h
 
-#include "all.h"
+#include "meds_all.h"
 
 
 extern Hashtable *instrmaps_hash;
diff --git a/xform/instruction_descriptor.cpp b/meds2pdb/instruction_descriptor.cpp
similarity index 94%
rename from xform/instruction_descriptor.cpp
rename to meds2pdb/instruction_descriptor.cpp
index 50595f6cff2fa228f98820ef1f94693439ac4b3c..c761d75b00cd5511fff5f2005f38d0ac6bad4f03 100644
--- a/xform/instruction_descriptor.cpp
+++ b/meds2pdb/instruction_descriptor.cpp
@@ -36,7 +36,7 @@ wahoo::Instruction::Instruction()
   m_data = NULL;
 }
 
-wahoo::Instruction::Instruction(app_iaddr_t p_address, int p_size, Function* p_func)
+wahoo::Instruction::Instruction(libIRDB::virtual_offset_t  p_address, int p_size, Function* p_func)
 {
   m_address = p_address;
   m_size = p_size;
diff --git a/xform/instruction_descriptor.h b/meds2pdb/instruction_descriptor.h
similarity index 85%
rename from xform/instruction_descriptor.h
rename to meds2pdb/instruction_descriptor.h
index 5efdf3b65a647011e8293b2c5a7215b506868058..5fdf972a4f0a3e3b0391966ced0538b993f4e3db 100644
--- a/xform/instruction_descriptor.h
+++ b/meds2pdb/instruction_descriptor.h
@@ -3,8 +3,9 @@
 
 #include <string>
 #include <set>
+#include <libIRDB-core.hpp>
 
-#include "targ-config.h"
+#include <libIRDB-core.hpp>
 
 using namespace std;
 
@@ -17,7 +18,7 @@ class Function;
 class Instruction {
   public:
     Instruction();
-    Instruction(app_iaddr_t, int p_size = -1, Function* = NULL);
+    Instruction(libIRDB::virtual_offset_t, int p_size = -1, Function* = NULL);
     ~Instruction();
 
     void setSize(int p_size) { m_size = p_size; }
@@ -28,7 +29,7 @@ class Instruction {
     void markStackRef();
     void markVarStackRef();
 
-    app_iaddr_t     getAddress() const { return m_address; }
+    libIRDB::virtual_offset_t     getAddress() const { return m_address; }
     int             getSize() const { return m_size; }
     Function*       getFunction() const { return m_function; }
     string          getAsm() const { return m_asm; }
@@ -47,7 +48,7 @@ class Instruction {
     bool isVisited() const { return m_isVisited; }
 
   private:
-    app_iaddr_t     m_address;
+    libIRDB::virtual_offset_t     m_address;
     int             m_size;
     Function*       m_function;
     string          m_asm;
diff --git a/xform/instrument.h b/meds2pdb/instrument.h
similarity index 80%
rename from xform/instrument.h
rename to meds2pdb/instrument.h
index 77a310ffc9d8b66fb36f083b3c808c08d509036e..753a3b37009a6f564be9618e9889c4a4f374f1f8 100644
--- a/xform/instrument.h
+++ b/meds2pdb/instrument.h
@@ -31,8 +31,8 @@
 
 /*
 no needed for SPRI
-void add_smp_instrumentation(strata_fragment_t *frag, app_iaddr_t PC, insn_t *insn);
-void add_smp_postinstrumentation(strata_fragment_t *frag, app_iaddr_t PC, insn_t *insn);
+void add_smp_instrumentation(strata_fragment_t *frag, libIRDB::virtual_offset_t PC, insn_t *insn);
+void add_smp_postinstrumentation(strata_fragment_t *frag, libIRDB::virtual_offset_t PC, insn_t *insn);
 */
 
 
@@ -58,7 +58,7 @@ struct reg_values
 
 /*
 no needed for SPRI
-app_iaddr_t targ_watched_called_instrument(app_iaddr_t next_PC, watch *w, strata_fragment_t *frag);
+libIRDB::virtual_offset_t targ_watched_called_instrument(libIRDB::virtual_offset_t next_PC, watch *w, strata_fragment_t *frag);
 */
 
 
diff --git a/tools/meds2pdb/meds2pdb.cpp b/meds2pdb/meds2pdb.cpp
similarity index 97%
rename from tools/meds2pdb/meds2pdb.cpp
rename to meds2pdb/meds2pdb.cpp
index 3eb03a6e14240be1f723371e3bf604766a7dfa24..56980d4683524eb44b3a87ad81bab0a15b47e8e0 100644
--- a/tools/meds2pdb/meds2pdb.cpp
+++ b/meds2pdb/meds2pdb.cpp
@@ -58,7 +58,7 @@ inline std::string my_to_string (const T& t)
 
 int next_address_id=0;
 
-map<app_iaddr_t,int> address_to_instructionid_map;
+map<libIRDB::virtual_offset_t,int> address_to_instructionid_map;
 map<wahoo::Instruction*,int> instruction_to_addressid_map;
 
 // extract the file id from the md5 hash and the program name
@@ -104,7 +104,7 @@ void insert_instructions(int fileID, const vector<wahoo::Instruction*> &instruct
     		char buf[128];
 
 		wahoo::Instruction *instruction = instructions[i];
-		app_iaddr_t   addr = instruction->getAddress();
+		libIRDB::virtual_offset_t   addr = instruction->getAddress();
 
 		// assign an instruction id
 		address_to_instructionid_map[addr]=next_address_id++;
@@ -204,7 +204,7 @@ void insert_functions(int fileID, const vector<wahoo::Function*> &functions  )
       if (j >= functions.size()) break;
       wahoo::Function *f = functions[j];
       string functionName = f->getName();
-      //app_iaddr_t functionAddress = f->getAddress();
+      //libIRDB::virtual_offset_t functionAddress = f->getAddress();
       int functionFrameSize =  f->getFrameSize(); 
 
       int function_id = j;
@@ -249,7 +249,7 @@ void update_functions(int fileID, const vector<wahoo::Function*> &functions  )
         if (j >= functions.size()) break;
       	wahoo::Function *f = functions[j];
       	string functionName = f->getName();
-      	app_iaddr_t functionAddress = f->getAddress();
+	libIRDB::virtual_offset_t functionAddress = f->getAddress();
       	//int functionSize = f->getSize();
       	int function_id = f->getFunctionID();
       	//int outArgsRegionSize = f->getOutArgsRegionSize();
@@ -347,7 +347,7 @@ void update_function_prototype(const vector<wahoo::Function*> &functions, char*
 			if (j >= functions.size()) break;
 			wahoo::Function *f = functions[j];
       			int function_id = f->getFunctionID();
-			app_iaddr_t functionAddress = f->getAddress();
+			libIRDB::virtual_offset_t functionAddress = f->getAddress();
 			VirtualOffset vo(functionAddress);
 
 			//MEDS_FuncPrototypeAnnotation* fn_prototype_annot = NULL; 
diff --git a/xform/all.h b/meds2pdb/meds_all.h
similarity index 94%
rename from xform/all.h
rename to meds2pdb/meds_all.h
index e670cbb1038453259eab667842f78ff7c4e4dc53..a06390efc1c72535ef52260e4b39f405c05c002f 100644
--- a/xform/all.h
+++ b/meds2pdb/meds_all.h
@@ -1,5 +1,5 @@
 /*
- * all.h
+ * meds_all.h
  *
  * Copyright (c) 2011 - University of Virginia 
  *
@@ -29,10 +29,11 @@
 #include <string.h>
 #include <assert.h>
 
+#include <libIRDB-core.hpp>
+
 #include "strata_defines.h"
 
 /* x86_32-specific headers */
-#include "targ-config.h"
 #include "instrument.h"
 
 #include "spri_alloc.h"
@@ -46,4 +47,6 @@
 #include "funclist_hash.h"
 #include "constant_hash.h"
 
+#include <inttypes.h>
+
 #endif
diff --git a/xform/null_transform.cpp b/meds2pdb/null_transform.cpp
similarity index 95%
rename from xform/null_transform.cpp
rename to meds2pdb/null_transform.cpp
index 491fda4b42ed2e7145df522e489f4bb5f4402598..37ca87aec163a7101f248a1c0aa2658edf028056 100644
--- a/xform/null_transform.cpp
+++ b/meds2pdb/null_transform.cpp
@@ -20,7 +20,7 @@
 
 #include <iostream>
 
-//#include "targ-config.h"
+#include <libIRDB-core.hpp>
 
 // #include "elfio/elfio.hpp"
 
@@ -49,9 +49,9 @@ using namespace wahoo;
 void NullTransform::rewrite()
 {
   // only transform instructions contained in well-defined functions
-  for (map<app_iaddr_t, wahoo::Function*>::iterator it = m_functions.begin(); it != m_functions.end(); ++it)
+  for (map<libIRDB::virtual_offset_t, wahoo::Function*>::iterator it = m_functions.begin(); it != m_functions.end(); ++it)
   {
-    app_iaddr_t addr = it->first;
+	  libIRDB::virtual_offset_t addr = it->first;
     wahoo::Function* f = it->second;
     if (!f)
     {
diff --git a/xform/null_transform.h b/meds2pdb/null_transform.h
similarity index 100%
rename from xform/null_transform.h
rename to meds2pdb/null_transform.h
diff --git a/xform/read_annot_file.c b/meds2pdb/read_annot_file.cpp
similarity index 92%
rename from xform/read_annot_file.c
rename to meds2pdb/read_annot_file.cpp
index 0be85b60804bb6d3aaf0ed5b1eaba294cd3a1b0a..ff88a9a0a23db5b8bc5d5bc1125d57be9a42d528 100644
--- a/xform/read_annot_file.c
+++ b/meds2pdb/read_annot_file.cpp
@@ -35,23 +35,24 @@
 
 // #include <stdio.h>
 // #include <string.h>
-#include "all.h"
+#include "meds_all.h"
 
 /*
  *  read_annot_file - read the annotations file provided by IDA Pro.
  */
 void read_annot_file(char fn[])
 {
-	FILE* fin;
-	app_iaddr_t addr;
+	FILE* fin=nullptr;
+	libIRDB::virtual_offset_t addr=0;
 	union { int size, type;} size_type_u;
 	char type[200];
 	char scope[200];
 	char remainder[200000];
-	char * objname;
+	/*char * objname; 
 	int pid=0;
-	int var_length=0;
+	int var_length=0; 
 	int bitvector_size_bits=0;
+	*/
 	int line=0;
 
 
@@ -76,7 +77,9 @@ void read_annot_file(char fn[])
 
 	do 
 	{
-		fscanf(fin, "%x %d\n", &addr, &size_type_u);
+		unsigned int tmp=0;
+		fscanf(fin, "%x %d\n", &tmp, &size_type_u.size);
+		addr=tmp;
 
 		if(feof(fin))		// deal with blank lines at the EOF
 			break;
@@ -141,7 +144,7 @@ void read_annot_file(char fn[])
 			else if(strcmp(scope,"MMSAFENESS")==0)
 			{
 				char safeness[1000];
-				fscanf(fin, "%s", &safeness);
+				fscanf(fin, "%s", safeness);
 				if(strcmp(safeness, "SAFE"))
 					frame_restore_hash_set_safe_bit(addr,TRUE);
 				else if(strcmp(safeness, "SPECSAFE"))
@@ -171,7 +174,7 @@ void read_annot_file(char fn[])
 				frame_restore_set_return_address(addr,offset);	
 			}
 	
-			printf("MEMORYHOLE, pc=%x offset=%d\n", addr, offset);
+			//printf("MEMORYHOLE, pc=%x offset=%d\n", addr, offset);
 			/* ignoring for now */
 		}
 		else if(strcmp(type,"LOCALFRAME")==0 || strcmp(type,"INARGS")==0)
@@ -185,7 +188,7 @@ void read_annot_file(char fn[])
 			/* add to hashtable, a name would be nice someday */
 			sshk->pc=addr;
 			sshv->size=size_type_u.size;
-			printf("Adding pc=%x size=%d to stackref hash table\n", sshk->pc, sshv->size);
+			// printf("Adding pc=%x size=%d to stackref hash table\n", sshk->pc, sshv->size);
 
 //			STRATA_LOG("annot","Adding pc=%x size=%d to stackref hash table\n", sshk->pc, sshv->size);
 			Hashtable_put(stackrefs_hash, sshk,sshv);	
@@ -205,12 +208,12 @@ void read_annot_file(char fn[])
 			}
             		else if (strcmp(scope, "DEADREGS") == 0)
             		{
-				stackref_hash_key_t sshk;
-				stackref_hash_value_t *sshv;
-				sshk.pc = addr;
+				// stackref_hash_key_t sshk;
+				// stackref_hash_value_t *sshv;
+				// sshk.pc = addr;
 				if (Hashtable_get(stackrefs_hash, &addr))
 				{
-					printf("STACK ALLOC INSTRUCTION CONFIRMED AT pc=0x%x size=%d\n", sshk.pc, size_type_u);
+					// printf("STACK ALLOC INSTRUCTION CONFIRMED AT pc=0x%x size=%d\n", sshk.pc, size_type_u);
 				}
 				
 #ifdef OLD_MEDS
@@ -275,8 +278,10 @@ void read_annot_file(char fn[])
 #endif
             		else if (strcmp(scope, "BELONGTO") == 0)
 			{
-				app_iaddr_t func_addr;
-				fscanf(fin, "%x", &func_addr);
+				libIRDB::virtual_offset_t func_addr;
+				unsigned int tmp=0;
+				fscanf(fin, "%x", &tmp);
+				func_addr=tmp;
                     		instrmap_hash_key_t* key = (instrmap_hash_key_t*)spri_allocate_type(sizeof(instrmap_hash_key_t));
                     		instrmap_hash_value_t* val = (instrmap_hash_value_t*)spri_allocate_type(sizeof(instrmap_hash_value_t));
                     		key->pc = addr;
@@ -535,8 +540,8 @@ void read_annot_file(char fn[])
 		}
 		else if(strcmp(type,"DATAREF")==0)
 		{
-			char name[1000], parent_child[1000], offset_str[1000];
-			int id, parent_id, offset, parent_offset;
+			char /* name[1000], */ parent_child[1000], offset_str[1000];
+			int id /*, parent_id, offset, parent_offset*/;
 			if(size_type_u.size<=0)
 			{
 //				STRATA_LOG("warn", "Found DATAREF of size <=0 at line %d of annot file\n", line);
@@ -544,7 +549,9 @@ void read_annot_file(char fn[])
 			else if(strcmp(scope,"GLOBAL")==0)
 			{
 				/* remaining params id, addr, parent/child, name */
-				fscanf(fin, "%d%x%s%s", &id, &addr, parent_child);
+				unsigned int tmp=0;
+				fscanf(fin, "%d%x%s%s", &id, &tmp, parent_child, offset_str);
+				addr=tmp;
 
 				if(strcmp(parent_child, "PARENT")==0)
 				{
@@ -562,7 +569,7 @@ void read_annot_file(char fn[])
 					if(strata_opt_do_smp_fine_grain && !STRATA_LOG_IS_ON("no_fine_grain_static"))
 					{
 						referent_object_t* new_ref;
-						fscanf(fin, "%d%s%d", &parent_id, offset_str, &parent_offset);
+						fscanf(fin, "%d%s%d", &parent_id, offset_str, parent_offset);
 						assert(strcmp("OFFSET", offset_str)==0);
 						referent_object_t *refnt=get_referent_from_id_map(parent_id);
 						new_ref=add_referent_field(refnt, parent_offset, addr, size_type_u.size);
@@ -576,11 +583,11 @@ void read_annot_file(char fn[])
 			}
 			else if(strcmp(scope,"STACK")==0)
 			{
-				char esp[1000], plus[1000], offset_str[1000];
+				char esp[1000], plus[1000]; // , offset_str[1000];
 				int esp_offset;
 
 				/* remaining params id, addr, parent/child, name */
-				fscanf(fin, "%d%s%s%d%s", &id, &esp, &plus, &esp_offset, parent_child);
+				fscanf(fin, "%d%s%s%d%s", &id, esp, plus, &esp_offset, parent_child);
 
 				assert(strcmp(esp, "esp")==0 && strcmp(plus,"+")==0);
 
@@ -589,17 +596,17 @@ void read_annot_file(char fn[])
 					/* add to the stackref hashtable, also record the id->stackref mapping so we can
 					 * can easily lookup the id for any fields we find.
 					 */
-                        		stackref_hash_value_t *sshv=add_stack_ref(addr,size_type_u.size, esp_offset);
+                        		/*stackref_hash_value_t *sshv=(stackref_hash_value_t *)*/(void)add_stack_ref(addr,size_type_u.size, esp_offset);
 					
-					printf("New stack frame at: pc=0x%x size=0x%x\n", addr, sshv->size);
+					// printf("New stack frame at: pc=0x%x size=0x%x\n", addr, sshv->size);
 
 #ifdef OLD_MEDS
 					//if(strata_opt_do_smp_fine_grain && !STRATA_LOG_IS_ON("no_fine_grain_stack"))
-					if(!STRATA_LOG_IS_ON("no_fine_grain_stack"))
-						add_to_stackref_id_map(id,sshv);
+					// if(!STRATA_LOG_IS_ON("no_fine_grain_stack"))
+						// add_to_stackref_id_map(id,sshv);
 
                         		/* add to hashtable, a name would be nice someday */
-                        		STRATA_LOG("annot","Adding pc=%x size=%d to stackref hash table\n", addr, sshv->size);
+                        		// STRATA_LOG("annot","Adding pc=%x size=%d to stackref hash table\n", addr, sshv->size);
 #endif
 				}
 				else if(strcmp(parent_child, "CHILDOF")==0)
diff --git a/xform/rewriter.cpp b/meds2pdb/rewriter.cpp
similarity index 95%
rename from xform/rewriter.cpp
rename to meds2pdb/rewriter.cpp
index fed74f5a9093f5a36a545cb409330db07131e4d2..a1f3b1ea8315c1237304dd05de62b4775d4b8502 100644
--- a/xform/rewriter.cpp
+++ b/meds2pdb/rewriter.cpp
@@ -26,8 +26,8 @@
 #include <libIRDB-core.hpp>
 
 
-#include "all.h"
-//#include "targ-config.h"
+#include "meds_all.h"
+#include <libIRDB-core.hpp>
 //#include "elfio/elfio.hpp"
 
 
@@ -54,7 +54,7 @@ Rewriter::~Rewriter()
 {
 }
 
-wahoo::Function* Rewriter::ensureFunctionExists(const app_iaddr_t p_addr)
+wahoo::Function* Rewriter::ensureFunctionExists(const libIRDB::virtual_offset_t p_addr)
 {
 	if (m_functions.count(p_addr) > 0)
 		return m_functions[p_addr];
@@ -65,7 +65,7 @@ wahoo::Function* Rewriter::ensureFunctionExists(const app_iaddr_t p_addr)
 	return fn;
 }
 
-wahoo::Instruction* Rewriter::ensureInstructionExists(const app_iaddr_t p_addr)
+wahoo::Instruction* Rewriter::ensureInstructionExists(const libIRDB::virtual_offset_t p_addr)
 {
 	if (m_instructions.count(p_addr) > 0)
 		return m_instructions[p_addr];
@@ -82,7 +82,7 @@ wahoo::Instruction* Rewriter::ensureInstructionExists(const app_iaddr_t p_addr)
 void Rewriter::readAnnotationFile(char p_filename[])
 {
 	FILE* fin=NULL;
-	app_iaddr_t addr = 0, prevStackDeallocPC = 0;
+	libIRDB::virtual_offset_t addr = 0, prevStackDeallocPC = 0;
 	union { int size, type;} size_type_u;
 	char type[200];
 	char scope[200];
@@ -323,7 +323,7 @@ void Rewriter::readAnnotationFile(char p_filename[])
 			}
 			else if (strcmp(scope, "BELONGTO") == 0)
 			{
-				app_iaddr_t func_addr;
+				libIRDB::virtual_offset_t func_addr;
 				ignore_result(fscanf(fin, "%p", (void**)&func_addr));
                     		instrmap_hash_key_t* key = (instrmap_hash_key_t*)spri_allocate_type(sizeof(instrmap_hash_key_t));
                     		instrmap_hash_value_t* val = (instrmap_hash_value_t*)spri_allocate_type(sizeof(instrmap_hash_value_t));
@@ -641,14 +641,14 @@ void Rewriter::readElfFile(char p_filename[])
 	sprintf(buf, "%s -d --prefix-addresses %s | grep \"^[0-9]\"", objdump, p_filename);
 	printf("Running objdump, like so: %s\n", buf);
 	FILE* pin=popen(buf, "r");
-	app_iaddr_t addr;
+	libIRDB::virtual_offset_t addr;
 
 	assert(pin);
 
 	
 	void* tmp=NULL;
 	ignore_result(fscanf(pin, "%p", &tmp));
-	addr=(app_iaddr_t)tmp;
+	addr=(libIRDB::virtual_offset_t)tmp;
 	ignore_result(fgets(buf,sizeof(buf),pin));
 	do 
 	{
@@ -658,7 +658,7 @@ void Rewriter::readElfFile(char p_filename[])
 			m_instructions[addr]=new wahoo::Instruction(addr,-1,NULL);
 		}
 		ignore_result(fscanf(pin,"%p", &tmp));
-		addr=(app_iaddr_t)tmp;
+		addr=(libIRDB::virtual_offset_t)tmp;
 		ignore_result(fgets(buf,sizeof(buf),pin));
 	} while(!feof(pin));
 
@@ -718,7 +718,7 @@ void Rewriter::disassemble()
     	}
 }
 
-void Rewriter::addSimpleRewriteRule(wahoo::Function* p_func, char *p_origInstr, int p_origSize, app_iaddr_t p_origAddress, char *p_newInstr)
+void Rewriter::addSimpleRewriteRule(wahoo::Function* p_func, char *p_origInstr, int p_origSize, libIRDB::virtual_offset_t p_origAddress, char *p_newInstr)
 {
   char buf[1024];
   char aspri[2048];
@@ -753,7 +753,7 @@ void Rewriter::commitFn2SPRI(wahoo::Function *p_func, FILE *p_fp)
 vector<wahoo::Function*> Rewriter::getCandidateFunctions()
 {
   vector<wahoo::Function*> candidates;
-  for (map<app_iaddr_t, wahoo::Function*>::iterator it = m_functions.begin(); it != m_functions.end(); ++it)
+  for (map<libIRDB::virtual_offset_t, wahoo::Function*>::iterator it = m_functions.begin(); it != m_functions.end(); ++it)
   {
     wahoo::Function* f = it->second;
 
@@ -769,7 +769,7 @@ vector<wahoo::Function*> Rewriter::getCandidateFunctions()
 vector<wahoo::Function*> Rewriter::getNonCandidateFunctions()
 {
   vector<wahoo::Function*> nonCandidates;
-  for (map<app_iaddr_t, wahoo::Function*>::iterator it = m_functions.begin(); it != m_functions.end(); ++it)
+  for (map<libIRDB::virtual_offset_t, wahoo::Function*>::iterator it = m_functions.begin(); it != m_functions.end(); ++it)
   {
     wahoo::Function* f = it->second;
 
@@ -786,7 +786,7 @@ vector<wahoo::Function*> Rewriter::getAllFunctions()
 {
   vector<wahoo::Function*> allFunctions;
 
-  for (map<app_iaddr_t, wahoo::Function*>::iterator it = m_functions.begin(); it != m_functions.end(); ++it)
+  for (map<libIRDB::virtual_offset_t, wahoo::Function*>::iterator it = m_functions.begin(); it != m_functions.end(); ++it)
   {
     wahoo::Function* f = it->second;
 
@@ -802,7 +802,7 @@ vector<wahoo::Instruction*> Rewriter::getAllInstructions()
 {
   vector<wahoo::Instruction*> allInstructions;
 
-  for (map<app_iaddr_t, wahoo::Instruction*>::iterator it = m_instructions.begin(); it != m_instructions.end(); ++it)
+  for (map<libIRDB::virtual_offset_t, wahoo::Instruction*>::iterator it = m_instructions.begin(); it != m_instructions.end(); ++it)
   {
     wahoo::Instruction* instr = it->second;
 
@@ -827,7 +827,7 @@ map<wahoo::Function*, double> Rewriter::getFunctionCoverage(char *p_instructionF
     return coverage;
   }
 
-  set<app_iaddr_t> visitedInstructions;
+  set<libIRDB::virtual_offset_t> visitedInstructions;
 
   infile.seekg(0,ios::end);
   size_t size = infile.tellg();
@@ -844,7 +844,7 @@ map<wahoo::Function*, double> Rewriter::getFunctionCoverage(char *p_instructionF
     
     infile>>hex>>address;
 
-    visitedInstructions.insert((app_iaddr_t) address);
+    visitedInstructions.insert((libIRDB::virtual_offset_t) address);
   }
 
   vector<wahoo::Instruction*> allInstructions = getAllInstructions();
diff --git a/xform/rewriter.h b/meds2pdb/rewriter.h
similarity index 74%
rename from xform/rewriter.h
rename to meds2pdb/rewriter.h
index acaa03664aef6753da5079f6ff2ae3c212daf48b..1b2a40a23ae54e1faf19b06210f2f9683143e1e2 100644
--- a/xform/rewriter.h
+++ b/meds2pdb/rewriter.h
@@ -1,6 +1,6 @@
 #include <map>
 #include <set>
-//#include "targ-config.h"
+#include <libIRDB-core.hpp>
 // #include "elfio/elfio.hpp"
 //#include "elfio/elfio_dump.hpp"
 
@@ -35,18 +35,18 @@ class Rewriter
     void disassemble();
 
     // one instruction modification
-    void addSimpleRewriteRule(wahoo::Function* p_func, char *p_origInstr, int p_origSize, app_iaddr_t p_origAddress, char *p_newInstr);
+    void addSimpleRewriteRule(wahoo::Function* p_func, char *p_origInstr, int p_origSize, libIRDB::virtual_offset_t p_origAddress, char *p_newInstr);
 
     // commit function to AsmSPRI file
     void commitFn2SPRI(wahoo::Function* p_func, FILE *p_file);
 
   protected:
-    map<app_iaddr_t, wahoo::Function*> m_functions;
-    map<app_iaddr_t, wahoo::Instruction*> m_instructions;
+    map<libIRDB::virtual_offset_t, wahoo::Function*> m_functions;
+    map<libIRDB::virtual_offset_t, wahoo::Instruction*> m_instructions;
 
   private:
-    wahoo::Function*     ensureFunctionExists(const app_iaddr_t);
-    wahoo::Instruction*  ensureInstructionExists(const app_iaddr_t);
+    wahoo::Function*     ensureFunctionExists(const libIRDB::virtual_offset_t);
+    wahoo::Instruction*  ensureInstructionExists(const libIRDB::virtual_offset_t);
 
   private:
     ElfReader*    m_elfReader;   
diff --git a/xform/spri_alloc.c b/meds2pdb/spri_alloc.cpp
similarity index 100%
rename from xform/spri_alloc.c
rename to meds2pdb/spri_alloc.cpp
diff --git a/xform/spri_alloc.h b/meds2pdb/spri_alloc.h
similarity index 100%
rename from xform/spri_alloc.h
rename to meds2pdb/spri_alloc.h
diff --git a/xform/stackref_hash.c b/meds2pdb/stackref_hash.cpp
similarity index 93%
rename from xform/stackref_hash.c
rename to meds2pdb/stackref_hash.cpp
index 232032968dbe26805c9b6d4bcbec4a135410ec9a..b6ee871f1c621ad37beeb07f5afa6b35e82decdb 100644
--- a/xform/stackref_hash.c
+++ b/meds2pdb/stackref_hash.cpp
@@ -21,7 +21,7 @@
  *
  */
 
-#include "all.h"
+#include "meds_all.h"
 #include "stackref_hash.h"
 
 /* 
@@ -47,7 +47,7 @@ long stackrefs_key_compare(void* key1, void* key2)
 
 
 /* add something to the stackrefs_hash hashtable */
-stackref_hash_value_t *add_stack_ref(app_iaddr_t pc,int size, int offset)
+stackref_hash_value_t *add_stack_ref(libIRDB::virtual_offset_t pc,int size, int offset)
 {
        	stackref_hash_key_t *sshk=(stackref_hash_key_t*)spri_allocate_type(sizeof(stackref_hash_key_t ));
        	stackref_hash_value_t *sshv=(stackref_hash_value_t*)spri_allocate_type(sizeof(stackref_hash_value_t ));
@@ -64,7 +64,7 @@ stackref_hash_value_t *add_stack_ref(app_iaddr_t pc,int size, int offset)
 	return sshv;
 }
 
-stackref_hash_value_t *add_stack_ref_field(stackref_hash_value_t* parent, app_iaddr_t pc, int size, int offset)
+stackref_hash_value_t *add_stack_ref_field(stackref_hash_value_t* parent, libIRDB::virtual_offset_t pc, int size, int offset)
 {
        	stackref_hash_key_t *sshk=(stackref_hash_key_t*)spri_allocate_type(sizeof(stackref_hash_key_t ));
        	stackref_hash_value_t *sshv=(stackref_hash_value_t*)spri_allocate_type(sizeof(stackref_hash_value_t ));
diff --git a/xform/stackref_hash.h b/meds2pdb/stackref_hash.h
similarity index 87%
rename from xform/stackref_hash.h
rename to meds2pdb/stackref_hash.h
index 64e272f8fdce8c868136400ce175486d11c19291..e409a9249ce6a6fd5deac41bfb00c7cdc5e82819 100644
--- a/xform/stackref_hash.h
+++ b/meds2pdb/stackref_hash.h
@@ -24,7 +24,7 @@
 #ifndef stackref_hash_h
 #define stackref_hash_h
 
-#include "all.h"
+#include "meds_all.h"
 
 
 /*
@@ -35,7 +35,7 @@ extern Hashtable *stackrefs_hash;
 typedef struct stackref_hash_key stackref_hash_key_t;
 struct stackref_hash_key
 {
-        app_iaddr_t pc;
+        libIRDB::virtual_offset_t pc;
 };
 
 typedef struct stackref_hash_value stackref_hash_value_t;
@@ -52,8 +52,8 @@ long stackrefs_compute_hash(void* key1);
 
 long stackrefs_key_compare(void* key1, void* key2);
 
-stackref_hash_value_t *add_stack_ref(app_iaddr_t pc,int size, int offset);
-stackref_hash_value_t *add_stack_ref_field(stackref_hash_value_t *parent, app_iaddr_t pc,int size, int offset);
+stackref_hash_value_t *add_stack_ref(libIRDB::virtual_offset_t pc,int size, int offset);
+stackref_hash_value_t *add_stack_ref_field(stackref_hash_value_t *parent, libIRDB::virtual_offset_t pc,int size, int offset);
 
 #endif
 
diff --git a/xform/strata_defines.h b/meds2pdb/strata_defines.h
similarity index 100%
rename from xform/strata_defines.h
rename to meds2pdb/strata_defines.h
diff --git a/tools/rida/SConscript b/rida/SConscript
similarity index 100%
rename from tools/rida/SConscript
rename to rida/SConscript
diff --git a/tools/rida/SConstruct b/rida/SConstruct
similarity index 100%
rename from tools/rida/SConstruct
rename to rida/SConstruct
diff --git a/tools/rida/rida.cpp b/rida/rida.cpp
similarity index 100%
rename from tools/rida/rida.cpp
rename to rida/rida.cpp
diff --git a/tools/thanos/SConscript b/thanos/SConscript
similarity index 100%
rename from tools/thanos/SConscript
rename to thanos/SConscript
diff --git a/tools/thanos/SConstruct b/thanos/SConstruct
similarity index 100%
rename from tools/thanos/SConstruct
rename to thanos/SConstruct
diff --git a/tools/thanos/thanos.cpp b/thanos/thanos.cpp
similarity index 100%
rename from tools/thanos/thanos.cpp
rename to thanos/thanos.cpp
diff --git a/tools/SConscript b/tools/SConscript
index a83cce77deeaf23e7148b274442ab2013ad11a4a..285442475a5c9c67ada5a5f5251713fe15a181dd 100644
--- a/tools/SConscript
+++ b/tools/SConscript
@@ -7,15 +7,10 @@ tools=[]
 dirs='''
 	cover
 	fix_rets
-        meds2pdb	
 	safefr
 	selective_cfi
 	spasm
-	dump_map
-	dump_insns
 	hook_start
-	rida
-	thanos
 	'''
 
 nobuild_dirs='''
diff --git a/tools/safefn/fill_in_safefn.cpp b/tools/safefn/fill_in_safefn.cpp
index ef6b7008207567d5a10a8eccbde0955fb0e0bca9..a2d6f66c47907aae124df8d77257d239f3f97d2a 100644
--- a/tools/safefn/fill_in_safefn.cpp
+++ b/tools/safefn/fill_in_safefn.cpp
@@ -28,8 +28,6 @@
 #include <assert.h>
 #include <libgen.h>
 
-#include "targ-config.h"
-
 #include "MEDS_AnnotationParser.hpp"
 #include "MEDS_SafeFuncAnnotation.hpp"
 
diff --git a/tools/safefr/fill_in_safefr.cpp b/tools/safefr/fill_in_safefr.cpp
index 9ba1b5674d49e7e5b23b063ad78cab46744a1c9b..ea4a5afd15bf6166830868bd291caffc3a30fb5b 100644
--- a/tools/safefr/fill_in_safefr.cpp
+++ b/tools/safefr/fill_in_safefr.cpp
@@ -28,8 +28,6 @@
 #include <assert.h>
 #include <libgen.h>
 
-#include "targ-config.h"
-
 #include "MEDS_AnnotationParser.hpp"
 #include "MEDS_FRSafeAnnotation.hpp"
 
diff --git a/tools/selective_cfi/SConscript b/tools/selective_cfi/SConscript
index e27170815e742a87bf0e7991180b0454513eaf44..a338045a0691f0b23318a285791ddb5c909276b0 100644
--- a/tools/selective_cfi/SConscript
+++ b/tools/selective_cfi/SConscript
@@ -28,10 +28,11 @@ pgm=myenv.Program(pgm,  files,  LIBPATH=LIBPATH, LIBS=LIBS)
 install=myenv.Install("$SECURITY_TRANSFORMS_HOME/plugins_install/", pgm)
 Default(install)
 
+ret=[]+install
 	
 	
 #lib32=SConscript("zest_cfi_runtime/SConscript", variant_dir="build32")
-zestcfi_lib=SConscript("zest_cfi_runtime/SConscript") # , variant_dir="build64")
-
-ret=[]+install+zestcfi_lib
+if 'ZEST_RUNTIME' in os.environ: 
+	zestcfi_lib=SConscript("zest_cfi_runtime/SConscript") # , variant_dir="build64")
+	ret=ret+zestcfi_lib
 Return('ret')
diff --git a/xform/Makefile.in b/xform/Makefile.in
deleted file mode 100644
index 04547b0f217c6a22d816f1c7f1f43d10901778e6..0000000000000000000000000000000000000000
--- a/xform/Makefile.in
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# Makefile.in - DESCRIPTION.
-#
-# Copyright (c) 2011 - University of Virginia
-#
-# This file may be used and modified for non-commercial purposes as long as 
-# all copyright, permission, and nonwarranty notices are preserved.  
-#
-# Please contact the authors for restrictions applying to commercial use.
-#
-# THIS SOURCE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
-# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
-# MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-#
-
-CC=@CXX@
-CFLAGS= -DUBUNTU -g
-DIR=..
-INCLUDEDIR=${DIR}/include
-INCLUDE=-I${INCLUDEDIR} -I. -I${DIR}/beaengine/include
-LIB=libxform.a
-
-OBJS= instruction_descriptor.o function_descriptor.o elfreader.o null_transform.o rewriter.o spri_alloc.o gen_hash.o constant_hash.o funclist_hash.o instrmap_hash.o framerestore_hash.o stackref_hash.o 
-
-.SUFFIXES: .o .c .cpp
-
-.cpp.o .c.o:
-	$(CC) $(CFLAGS) $(INCLUDE) -c $<
-
-
-all: ../lib/$(LIB)
-	echo $(LIB) build complete
-
-$(LIB): $(OBJS)
-	ar -r $(LIB) $(OBJS) 
-
-../lib/$(LIB): $(LIB)
-	cp $(LIB) ../lib/
-
-clean:
-	rm -f *.o core *.a
-
-stackref_hash.o gen_hash.o: *.h stackref_hash.c gen_hash.c
-	$(CC) $(CFLAGS) $(INCLUDE) -fomit-frame-pointer -c $*.c
-
-$(OBJS): *.h