diff --git a/include/interfaces/SMPDBInterface.h b/include/interfaces/SMPDBInterface.h
index e240c1256f8625e5a73bf4ce694942ff26594609..73d19ed3b6a6a6ea3ff68a1f4c165a540558bb22 100644
--- a/include/interfaces/SMPDBInterface.h
+++ b/include/interfaces/SMPDBInterface.h
@@ -175,6 +175,10 @@ extern const char *CallTypeNames[4];
 #define SMP_fopen(name, mode) global_stars_interface->STARS_fopen(name, mode)
 #define SMP_feof(file) feof(file)
 #define SMP_fclose(file) global_stars_interface->STARS_fclose(file)
+#define SMP_ftell(file) global_stars_interface->STARS_ftell(file)
+#define SMP_fgetc(file) global_stars_interface->STARS_fgetc(file)
+#define SMP_fgets(buffer, buflen, file) global_stars_interface->STARS_fgets(buffer, buflen, file)
+#define SMP_fseek(file, offset, whence) global_stars_interface->STARS_fseek(file, offset, whence)
 
 #define SMP_getseg(addr)  (global_stars_interface->getseg(addr))
 #define SMP_getnseg(index) (global_stars_interface->getnseg(index))
diff --git a/include/interfaces/abstract/STARSInterface.h b/include/interfaces/abstract/STARSInterface.h
index d3e80020db69001fd65fb931ae290c34e8aa6010..169bab60b702e877397a1d6efd8389818c39f341 100644
--- a/include/interfaces/abstract/STARSInterface.h
+++ b/include/interfaces/abstract/STARSInterface.h
@@ -57,6 +57,10 @@ class STARS_Interface_t
 		virtual int STARS_msg(const char *format, ...) = 0;
 		virtual int STARS_fprintf(FILE *fp, const char *format, ...) = 0;
 		virtual int STARS_fscanf(FILE *fp, const char *format, ...) = 0;
+		virtual long STARS_ftell(FILE *fp) = 0;
+		virtual int STARS_fgetc(FILE *fp) = 0;
+		virtual char *STARS_fgets(char *buffer, int buflen, FILE *fp) = 0;
+		virtual int STARS_fseek(FILE *fp, long offset, int whence) = 0;
 
 		// String methods
 		virtual char *STARS_strncat(char *dst, const char *src, std::size_t dstsize) = 0;
diff --git a/include/interfaces/idapro/STARSInterface.h b/include/interfaces/idapro/STARSInterface.h
index 23c0f3576beb2921f4bbeaff51aef83c288121e3..490d00155e16528c2edaa64588a88f2546e0d966 100644
--- a/include/interfaces/idapro/STARSInterface.h
+++ b/include/interfaces/idapro/STARSInterface.h
@@ -82,6 +82,10 @@ public:
 	virtual int STARS_msg(const char *format, ...);
 	virtual int STARS_fprintf(FILE *fp, const char *format, ...);
 	virtual int STARS_fscanf(FILE *fp, const char *format, ...);
+	virtual long STARS_ftell(FILE *fp);
+	virtual char *STARS_fgets(char *buffer, int buflen, FILE *fp);
+	virtual int STARS_fseek(FILE *fp, long offset, int whence);
+	virtual int STARS_fgetc(FILE *fp) { return qfgetc(fp); };
 
 	// String methods
 	virtual char *STARS_strncat(char *dst, const char *src, std::size_t dstsize) { return qstrncat(dst, src, dstsize); };
diff --git a/src/base/ProfilerInformation.cpp b/src/base/ProfilerInformation.cpp
index a80e2cbcf23ff96da301223ad641efdd8d4fdd46..b571653c51d988d13ab45f1bc53dd6f8f6be303b 100644
--- a/src/base/ProfilerInformation.cpp
+++ b/src/base/ProfilerInformation.cpp
@@ -24,18 +24,13 @@
  * URL   : http://www.zephyr-software.com/
  */
 
-
 #include <string>
+#include <bitset>
+
+#include <cassert>
 #include <cstdlib>
 #include <ctime>
 #include <cstring>
-#include <bitset>
-
-#include <pro.h>
-#include <assert.h>
-#include <ida.hpp>
-#include <idp.hpp>
-#include <intel.hpp>
 
 using namespace std;
 
@@ -131,12 +126,12 @@ ProfilerInformation::ProfilerInformation(const char* fn, SMPProgram *CurrProg)
 
 	do 
 	{
-		qfscanf(fin, "%x %d\n", &addr, &(size_type_u.size));
+		SMP_fscanf(fin, "%x %d\n", &addr, &(size_type_u.size));
 
 		if (SMP_feof(fin))		// deal with blank lines at the EOF
 			break;
 		
-		qfscanf(fin, "%s%s", type, scope);
+		SMP_fscanf(fin, "%s%s", type, scope);
 
 		if (strcmp(type, "FUNC") == 0)
 		{
@@ -164,7 +159,7 @@ ProfilerInformation::ProfilerInformation(const char* fn, SMPProgram *CurrProg)
 			if (strcmp(scope, "INDIRECTCALL")==0)
 			{
 				int target;
-				qfscanf(fin, "%d", &target);
+				SMP_fscanf(fin, "%d", &target);
 
 				indirect_call_map[addr].insert(target); 
 				this->ProfilerAnnotsRead++;
@@ -173,9 +168,11 @@ ProfilerInformation::ProfilerInformation(const char* fn, SMPProgram *CurrProg)
 #if 1
 				// record the PROF_FIELD into the constant info structure so it's output with the other
 				// profile information.  Then rewind and parse out the information correctly.
-				long pos = qftell(fin);
-				qfgets(remainder, sizeof(remainder), fin);
-				qfseek(fin, pos, SEEK_SET);
+				long pos = SMP_ftell(fin);
+				char *ResultStr = SMP_fgets(remainder, sizeof(remainder), fin);
+				assert(NULL != ResultStr);
+				int ResultCode = SMP_fseek(fin, pos, SEEK_SET);
+				assert(0 == ResultCode);
 				std::string output_string(remainder);
 #if 1
 				SMP_snprintf(remainder, sizeof(remainder), "%x %d %s %s ", addr, size_type_u.size, "INSTR", "PROF_FIELD");
@@ -201,10 +198,10 @@ ProfilerInformation::ProfilerInformation(const char* fn, SMPProgram *CurrProg)
 			assert(strcmp(scope, "STACK") == 0 || strcmp(scope, "GLOBAL") == 0);
 
 			/* remaining params are <const> <field> <real_const_if_global> <comment> */ 
-			qfscanf(fin, "%d %s", &the_const, field);
+			SMP_fscanf(fin, "%d %s", &the_const, field);
 			if (strcmp(type,"PTRIMMEDESP2") == 0 || 
 				strcmp(type,"PTRIMMEDABSOLUTE") == 0)
-				qfscanf(fin, "%x", &real_const);
+				SMP_fscanf(fin, "%x", &real_const);
 			else
 				real_const = the_const;
 
@@ -257,7 +254,7 @@ ProfilerInformation::ProfilerInformation(const char* fn, SMPProgram *CurrProg)
 	
 		int TempChar;
 		do {
-			TempChar = qfgetc(fin);
+			TempChar = SMP_fgetc(fin);
 		} while ((TempChar != '\n') && (TempChar != EOF));
 		line++;
 	} while (!SMP_feof(fin));
@@ -532,7 +529,7 @@ void MemoryAccessInfo::ProcessMemoryAccessAnnotation(FILE *fin, int addr) {
 	size_t BitVectorSize; // in bits
 	size_t HexGroups; // how many 32-bit hex fields for bit vector
 
-	qfscanf(fin, "%s", NameAddrsSize);
+	SMP_fscanf(fin, "%s", NameAddrsSize);
 	char *EndPtr;
 // #if defined(WIN32) && (IDA_SDK_VERSION < 640)
 // Visual Studio has deprecated strtok() and puts out a warning. Disable it
@@ -540,8 +537,9 @@ void MemoryAccessInfo::ProcessMemoryAccessAnnotation(FILE *fin, int addr) {
 // #pragma warning(disable:4996)
 // #elif (IDA_SDK_VERSION >= 640)
 	// IDA 6.4 and later won't allow strtok, use thread-safe IDA-provided qstrtok
+	// Better idea: Use the new C++11 strtok_s() when we fully convert to C++11 instead of C++0x
 	char *saveptr;
-#define strtok(STR, DELIM) qstrtok(STR, DELIM, &saveptr);
+#define strtok(STR, DELIM) strtok_r(STR, DELIM, &saveptr);
 // #endif
 	char *NamePtr = strtok(NameAddrsSize, ":");
 	SMP_strncpy(ObjectName, NamePtr, STARS_MAXSTR-1);
@@ -570,7 +568,7 @@ void MemoryAccessInfo::ProcessMemoryAccessAnnotation(FILE *fin, int addr) {
 
 	ObjectSize = (size_t) SignedObjectSize;
 	string ObjectString(ObjectName);
-	qfscanf(fin, "%d %zu %zu %zu", &ProcessID, &RedundantObjectSize,
+	SMP_fscanf(fin, "%d %zu %zu %zu", &ProcessID, &RedundantObjectSize,
 		&BitVectorSize, &HexGroups);
 	assert(RedundantObjectSize == ObjectSize);
 	assert(BitVectorSize == (3 * ObjectSize));
@@ -697,7 +695,7 @@ void MemoryAccessInfo::ProcessMemoryAccessAnnotation(FILE *fin, int addr) {
 			break;
 		}
 
-		qfscanf(fin, "%x", &CurrHexGroup);
+		SMP_fscanf(fin, "%x", &CurrHexGroup);
 		if (SMP_feof(fin)) {
 			SMP_msg("ERROR: Premature end of line on memory access annotation for address %lx\n",
 				(unsigned long) InstructionAddress);
diff --git a/src/base/SMPFunction.cpp b/src/base/SMPFunction.cpp
index f456c959684ca39cce8ba027b0dcb527b6881dd8..80d0df3127586cc4719a0ac3f9e20cc2c5ba1f89 100644
--- a/src/base/SMPFunction.cpp
+++ b/src/base/SMPFunction.cpp
@@ -45,20 +45,6 @@ using namespace std;
 #include <cstdlib>
 #include <cassert>
 
-// #include <pro.h>
-// #include <ua.hpp>
-// #include <intel.hpp>
-
-#if 0
-#include <ida.hpp>
-#include <idp.hpp>
-#include <auto.hpp>
-#include <bytes.hpp>
-#include <funcs.hpp>
-#include <name.hpp>
-#include <struct.hpp>
-#endif
-
 #include "interfaces/SMPDBInterface.h"
 #include "base/SMPDataFlowAnalysis.h"
 #include "base/SMPFunction.h"
diff --git a/src/base/SMPProgram.cpp b/src/base/SMPProgram.cpp
index 55726511e571f5a396972b3ad91d315fd34e1bb9..080c90263be4c4afc8d3f998c972d6320a731394 100644
--- a/src/base/SMPProgram.cpp
+++ b/src/base/SMPProgram.cpp
@@ -40,23 +40,11 @@
 #include <vector>
 #include <algorithm>
 
+#include <cstdint>
 #include <cstring>
 #include <cstdlib>
 #include <cassert>
 
-#include <pro.h>
-#include <ua.hpp>
-#include <intel.hpp>
-
-#if 0
-#include <ida.hpp>
-#include <idp.hpp>
-#include <auto.hpp>
-#include <bytes.hpp>
-#include <funcs.hpp>
-#include <name.hpp>
-#endif
-
 #include "interfaces/SMPDBInterface.h"
 #include "base/SMPDataFlowAnalysis.h"
 #include "base/SMPFunction.h"
@@ -88,6 +76,9 @@ static const char *DataTypes[] = { "VOID", "NUMHEX", "NUMDEC", "CHAR",
 "STRUCTOFFSET", "STACKVAR", "NUMFLOAT", "UNKNOWN", 
 "UNKNOWN", "UNKNOWN", 0};
 
+// Imitate IDA Pro get_optype_flags0() from <bytes.hpp>
+#define STARS_get_optype_flags0(flags) (flags & 0x00F00000LU)
+
 #if 0
 // Is Address in a data segment?
 bool IsDataAddress(STARS_ea_t Address) {
@@ -676,14 +667,14 @@ void SMPProgram::EmitDataAnnotations(FILE *AnnotFile, FILE *InfoAnnotFile) {
 			if (TempGlobal.ReadOnly) {
 				SMP_fprintf(AnnotFile, 
 					"%10x %6zu DATAREF GLOBAL %8lu %llx PARENT %s  %s RO\n",
-					0, TempGlobal.size, ParentReferentID, (uint64) TempGlobal.addr,
-					TempGlobal.name, DataTypes[get_optype_flags0(TempGlobal.flags) >> 20]);
+					0, TempGlobal.size, ParentReferentID, (uint64_t) TempGlobal.addr,
+					TempGlobal.name, DataTypes[STARS_get_optype_flags0(TempGlobal.flags) >> 20]);
 			}
 			else {
 				SMP_fprintf(AnnotFile, 
 					"%10x %6zu DATAREF GLOBAL %8lu %llx PARENT %s  %s RW\n",
-					0, TempGlobal.size, ParentReferentID, (uint64) TempGlobal.addr,
-					TempGlobal.name, DataTypes[get_optype_flags0(TempGlobal.flags) >> 20]);
+					0, TempGlobal.size, ParentReferentID, (uint64_t) TempGlobal.addr,
+					TempGlobal.name, DataTypes[STARS_get_optype_flags0(TempGlobal.flags) >> 20]);
 			}
 		}
 		else { // structured object with fields
@@ -691,14 +682,14 @@ void SMPProgram::EmitDataAnnotations(FILE *AnnotFile, FILE *InfoAnnotFile) {
 			if (TempGlobal.ReadOnly) {
 				SMP_fprintf(AnnotFile, 
 					"%10x %6zu DATAREF GLOBAL %8lu %llx PARENT %s  %s RO AGGREGATE\n",
-					0, TempGlobal.size, ParentReferentID, (uint64) TempGlobal.addr,
-					TempGlobal.name, DataTypes[get_optype_flags0(TempGlobal.flags) >> 20]);
+					0, TempGlobal.size, ParentReferentID, (uint64_t) TempGlobal.addr,
+					TempGlobal.name, DataTypes[STARS_get_optype_flags0(TempGlobal.flags) >> 20]);
 			}
 			else {
 				SMP_fprintf(AnnotFile, 
 					"%10x %6zu DATAREF GLOBAL %8lu %llx PARENT %s  %s RW AGGREGATE\n",
-					0, TempGlobal.size, ParentReferentID, (uint64) TempGlobal.addr,
-					TempGlobal.name, DataTypes[get_optype_flags0(TempGlobal.flags) >> 20]);
+					0, TempGlobal.size, ParentReferentID, (uint64_t) TempGlobal.addr,
+					TempGlobal.name, DataTypes[STARS_get_optype_flags0(TempGlobal.flags) >> 20]);
 			}
 			// Now, emit an annotation for each field offset.
 			set<pair<size_t,bool>, LessOff>::iterator FieldIter, TempIter;
@@ -717,7 +708,7 @@ void SMPProgram::EmitDataAnnotations(FILE *AnnotFile, FILE *InfoAnnotFile) {
 				}
 				SMP_fprintf(AnnotFile, 
 					"%10x %6zu DATAREF GLOBAL %8lu %llx CHILDOF %lu OFFSET %zu %s + %zu FIELD",
-					0, FieldSize, global_STARS_program->GetDataReferentID(), (uint64) TempGlobal.addr, ParentReferentID, 
+					0, FieldSize, global_STARS_program->GetDataReferentID(), (uint64_t) TempGlobal.addr, ParentReferentID, 
 					CurrOffset.first, TempGlobal.name, CurrOffset.first);
 				if (CurrOffset.second) { // indexed accesses to this field
 					SMP_fprintf(AnnotFile, " INDEXED\n");
@@ -829,7 +820,7 @@ FuncType SMPProgram::RecurseAndMarkRetAdd(SMPFunction* FuncAttrib) {
 #if SMP_DEBUG_FUNC
 				// if a call target is unsafe note it down
 				static char StaticFuncName[MAXSMPSTR];
-				qstrncpy(StaticFuncName, ChildInstance->GetFuncName(), (MAXSMPSTR-1));
+				SMP_strncpy(StaticFuncName, ChildInstance->GetFuncName(), (MAXSMPSTR-1));
 				SMP_msg("Function %s marked as unsafe because %s is unsafe.\n", 
 					FuncAttrib->GetFuncName(), StaticFuncName);
 #endif
@@ -842,7 +833,7 @@ FuncType SMPProgram::RecurseAndMarkRetAdd(SMPFunction* FuncAttrib) {
 #if SMP_DEBUG_FUNC
 				// if a call target is unanalyzed, assume it is UNSAFE
 				static char StaticFuncName[MAXSMPSTR];
-				qstrncpy(StaticFuncName, ChildInstance->GetFuncName(), (MAXSMPSTR-1));
+				SMP_strncpy(StaticFuncName, ChildInstance->GetFuncName(), (MAXSMPSTR-1));
 				SMP_msg("Function %s marked as unsafe because %s is unanalyzed.\n", 
 					FuncAttrib->GetFuncName(), StaticFuncName);
 #endif
@@ -954,7 +945,7 @@ void SMPProgram::PrioritizeCallGraph(void) {
 	while (MapIter != this->TempFuncMap.end()) {
 		CurrFunc = MapIter->second;
 		if (NULL == CurrFunc) {
-			SMP_msg("ERROR: NULL Func ptr in TempFuncMap for %llx\n", (uint64) MapIter->first);
+			SMP_msg("ERROR: NULL Func ptr in TempFuncMap for %llx\n", (uint64_t) MapIter->first);
 			++MapIter;
 			continue;
 		}
@@ -988,7 +979,7 @@ void SMPProgram::PrioritizeCallGraph(void) {
 					this->TempFuncMap.erase(NextMapIter);
 #if STARS_DEBUG_CALL_GRAPH_PRIORITY
 					SMP_msg("INFO: PrioritizeCallGraph selecting unprocessed callee at %llx for func at %llx\n",
-						(uint64) CalleeAddr, (uint64) BestMapIter->first);
+						(uint64_t) CalleeAddr, (uint64_t) BestMapIter->first);
 #endif
 				}
 				else {
@@ -996,7 +987,7 @@ void SMPProgram::PrioritizeCallGraph(void) {
 					this->FuncList.push_back(*BestMapIter);
 #if STARS_DEBUG_CALL_GRAPH_PRIORITY
 					SMP_msg("INFO: PrioritizeCallGraph could not find callee at %llx; had to work on func at %llx\n",
-						(uint64) CalleeAddr, (uint64) BestMapIter->first);
+						(uint64_t) CalleeAddr, (uint64_t) BestMapIter->first);
 #endif
 					this->TempFuncMap.erase(BestMapIter);
 				}
@@ -1005,7 +996,7 @@ void SMPProgram::PrioritizeCallGraph(void) {
 				// Work on the BestMapIter function itself.
 				this->FuncList.push_back(*BestMapIter);
 #if STARS_DEBUG_CALL_GRAPH_PRIORITY
-				SMP_msg("INFO: PrioritizeCallGraph found STARS_BADADDR for callee; had to work on func at %llx\n", (uint64) BestMapIter->first);
+				SMP_msg("INFO: PrioritizeCallGraph found STARS_BADADDR for callee; had to work on func at %llx\n", (uint64_t) BestMapIter->first);
 #endif
 				this->TempFuncMap.erase(BestMapIter);
 			}
diff --git a/src/interfaces/idapro/STARSInterface.cpp b/src/interfaces/idapro/STARSInterface.cpp
index 9f1f44e8cca953b049a9a9c5e4c0ba56af2450ce..c90c214e5246255480774cabd69a64188a2d37f0 100644
--- a/src/interfaces/idapro/STARSInterface.cpp
+++ b/src/interfaces/idapro/STARSInterface.cpp
@@ -33,6 +33,19 @@ int STARS_IDA_Interface_t::STARS_fscanf(FILE *fp, const char *format, ...) {
 	return code;
 }
 
+long STARS_IDA_Interface_t::STARS_ftell(FILE *fp) {
+	return (long) qftell(fp);
+}
+
+char * STARS_IDA_Interface_t::STARS_fgets(char *buffer, int buflen, FILE *fp) {
+	return qfgets(buffer, buflen, fp);
+}
+
+int STARS_IDA_Interface_t::STARS_fseek(FILE *fp, long offset, int whence) {
+	return qfseek(fp, offset, whence);
+}
+
+
 int STARS_IDA_Interface_t::STARS_msg(const char *format, ...) {
 	va_list va;
 	va_start(va, format);