diff --git a/src/debug.h b/src/debug.h
new file mode 100644
index 0000000000000000000000000000000000000000..0092c0c74834e55e0c5b119baf75dcc659723afc
--- /dev/null
+++ b/src/debug.h
@@ -0,0 +1,12 @@
+#ifndef _DEBUG_H_
+#define _DEBUG_H_
+
+
+#ifndef NDEBUG
+#include <stdio.h>
+#define debug_printf(...) fprintf(stderr, __VA_ARGS__)
+#else
+#define debug_printf(...)
+#endif
+
+#endif
diff --git a/src/passbook.c b/src/passbook.c
index 64ca94396f7bd66922c812f67660526e2bddd8de..89af7fe3ef4fc66352f483bae98a88167825ef55 100644
--- a/src/passbook.c
+++ b/src/passbook.c
@@ -298,7 +298,7 @@ nodeptr_list_t list_dequeue(nodeptr_list_t lst, const node_t **out){
   }
 }
 
-
+#ifdef UNUSED_FUNCTIONS
 nodeptr_list_t list_destroy(nodeptr_list_t lst){
   while (lst.head != NULL){
     lst = list_pop(lst,NULL);
@@ -325,7 +325,7 @@ void list_print_rev(nodeptr_list_t lst){
   }
   printf("End list reverse print.\n\n");
 }
-
+#endif
 
 /* in order traversal to print out nodes in sorted order */
 void print_inorder(const node_t *p){
@@ -483,7 +483,7 @@ static int run(FILE *f){
     }
     if (inst[MAX_LINE_LENGTH] != '\0'){
       if (!(inst[MAX_LINE_LENGTH] == '\n' && inst[MAX_LINE_LENGTH+1] == '\0')){
-        debug_printf("Line %d exceeds maximum length (%d)\n",instructionCount+1,MAX_LINE_LENGTH);
+        fprintf(stderr,"Line %d exceeds maximum length (%d)\n",instructionCount+1,MAX_LINE_LENGTH);
         debug_printf("(Expected at array index %d to find NUL but found '%c' (%d))\n",MAX_LINE_LENGTH,inst[MAX_LINE_LENGTH],inst[MAX_LINE_LENGTH]);
         fclose(f);
         return -1;
@@ -518,7 +518,7 @@ static int run(FILE *f){
     char c;
     int res = fread(&c,1,1,f);
     if (res == 1){
-      debug_printf("Number of instructions (lines) in file exceeds max (%d)\n",MAX_INSTRUCTIONS);
+      fprintf(stderr,"Number of instructions (lines) in file exceeds max (%d)\n",MAX_INSTRUCTIONS);
       fclose(f);
       return -1;
     }else{