diff --git a/apps/app_zapras.c b/apps/app_zapras.c
index 1e57c74bdbeda9191e2ec6ba6fcccbcc0bde430d..8896eb2746691c962919803524253d057cd2b236 100644
--- a/apps/app_zapras.c
+++ b/apps/app_zapras.c
@@ -126,12 +126,6 @@ static pid_t spawn_ras(struct ast_channel *chan, char *args)
 	argv[argc++] = "zaptel.so";
 	argv[argc++] = "stdin";
 
-#if 0
-	for (x=0;x<argc;x++) {
-		fprintf(stderr, "Arg %d: %s\n", x, argv[x]);
-	}
-#endif
-
 	/* Finally launch PPP */
 	execv(PPP_EXEC, argv);
 	fprintf(stderr, "Failed to exec PPPD!\n");
diff --git a/asterisk.c b/asterisk.c
index 118d4fe03419983467af5fbc09aaa9f6e8f0e397..69af7d4cb3fa1c6209e7a120475980da7dbc5a42 100644
--- a/asterisk.c
+++ b/asterisk.c
@@ -983,15 +983,9 @@ static int ast_tryconnect(void)
  Called by soft_hangup to interrupt the poll, read, or other
  system call.  We don't actually need to do anything though.  
  Remember: Cannot EVER ast_log from within a signal handler 
- SLD: seems to be some pthread activity relating to the printf anyway:
- which is leading to a deadlock? 
  */
 static void urg_handler(int num)
 {
-#if 0
-	if (option_debug > 2) 
-		printf("-- Asterisk Urgent handler\n");
-#endif
 	signal(num, urg_handler);
 	return;
 }
@@ -1248,46 +1242,40 @@ static void consolehandler(char *s)
 {
 	printf(term_end());
 	fflush(stdout);
+
 	/* Called when readline data is available */
-	if (s && !ast_all_zeros(s))
+	if (!ast_all_zeros(s))
 		ast_el_add_history(s);
-	/* Give the console access to the shell */
-	if (s) {
-		/* The real handler for bang */
-		if (s[0] == '!') {
-			if (s[1])
-				ast_safe_system(s+1);
-			else
-				ast_safe_system(getenv("SHELL") ? getenv("SHELL") : "/bin/sh");
-		} else 
+	/* The real handler for bang */
+	if (s[0] == '!') {
+		if (s[1])
+			ast_safe_system(s+1);
+		else
+			ast_safe_system(getenv("SHELL") ? getenv("SHELL") : "/bin/sh");
+	} else 
 		ast_cli_command(STDOUT_FILENO, s);
-	} else
-		fprintf(stdout, "\nUse \"quit\" to exit\n");
 }
 
 static int remoteconsolehandler(char *s)
 {
 	int ret = 0;
+
 	/* Called when readline data is available */
-	if (s && !ast_all_zeros(s))
+	if (!ast_all_zeros(s))
 		ast_el_add_history(s);
-	/* Give the console access to the shell */
-	if (s) {
-		/* The real handler for bang */
-		if (s[0] == '!') {
-			if (s[1])
-				ast_safe_system(s+1);
-			else
-				ast_safe_system(getenv("SHELL") ? getenv("SHELL") : "/bin/sh");
-			ret = 1;
-		}
-		if ((strncasecmp(s, "quit", 4) == 0 || strncasecmp(s, "exit", 4) == 0) &&
-		    (s[4] == '\0' || isspace(s[4]))) {
-			quit_handler(0, 0, 0, 0);
-			ret = 1;
-		}
-	} else
-		fprintf(stdout, "\nUse \"quit\" to exit\n");
+	/* The real handler for bang */
+	if (s[0] == '!') {
+		if (s[1])
+			ast_safe_system(s+1);
+		else
+			ast_safe_system(getenv("SHELL") ? getenv("SHELL") : "/bin/sh");
+		ret = 1;
+	}
+	if ((strncasecmp(s, "quit", 4) == 0 || strncasecmp(s, "exit", 4) == 0) &&
+	    (s[4] == '\0' || isspace(s[4]))) {
+		quit_handler(0, 0, 0, 0);
+		ret = 1;
+	}
 
 	return ret;
 }
@@ -2733,7 +2721,7 @@ int main(int argc, char *argv[])
 				consolehandler((char *)buf);
 			} else {
 				if (write(STDOUT_FILENO, "\nUse EXIT or QUIT to exit the asterisk console\n",
-						strlen("\nUse EXIT or QUIT to exit the asterisk console\n")) < 0) {
+					  strlen("\nUse EXIT or QUIT to exit the asterisk console\n")) < 0) {
 					/* Whoa, stdout disappeared from under us... Make /dev/null's */
 					int fd;
 					fd = open("/dev/null", O_RDWR);
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 7dfbd444f482d3241e8a457efd8d323935ead482..3ec95bacc35cae7ee0538cac732806b3f7877f26 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -2164,10 +2164,7 @@ static void update_jbsched(struct chan_iax2_pvt *pvt)
 	
 	when = ast_tvdiff_ms(ast_tvnow(), pvt->rxcore);
 	
-	/*    fprintf(stderr, "now = %d, next=%d\n", when, jb_next(pvt->jb)); */
-	
 	when = jb_next(pvt->jb) - when;
-	/*   fprintf(stderr, "when = %d\n", when); */
 	
 	if(pvt->jbid > -1) ast_sched_del(sched, pvt->jbid);
 	
@@ -2202,7 +2199,6 @@ static void __get_from_jb(void *p)
 		return;
 	}
 
-	/*  fprintf(stderr, "get_from_jb called\n"); */
 	pvt->jbid = -1;
 	
 	gettimeofday(&tv,NULL);
@@ -2217,7 +2213,6 @@ static void __get_from_jb(void *p)
 		ret = jb_get(pvt->jb,&frame,now,ast_codec_interp_len(pvt->voiceformat));
 		switch(ret) {
 		case JB_OK:
-			/*if(frame.type == JB_TYPE_VOICE && next + 20 != jb_next(pvt->jb)) fprintf(stderr, "NEXT %ld is not %ld+20!\n", jb_next(pvt->jb), next); */
 			fr = frame.data;
 			__do_deliver(fr);
 			break;
@@ -2225,10 +2220,7 @@ static void __get_from_jb(void *p)
 		{
 			struct ast_frame af;
 			
-			/*if(next + 20 != jb_next(pvt->jb)) fprintf(stderr, "NEXT %ld is not %ld+20!\n", jb_next(pvt->jb), next); */
-			
 			/* create an interpolation frame */
-			/*fprintf(stderr, "Making Interpolation frame\n"); */
 			af.frametype = AST_FRAME_VOICE;
 			af.subclass = pvt->voiceformat;
 			af.datalen  = 0;
@@ -2246,7 +2238,6 @@ static void __get_from_jb(void *p)
 		}
 		break;
 		case JB_DROP:
-			/*if(next != jb_next(pvt->jb)) fprintf(stderr, "NEXT %ld is not next %ld!\n", jb_next(pvt->jb), next); */
 			iax2_frame_free(frame.data);
 			break;
 		case JB_NOFRAME:
@@ -3435,9 +3426,6 @@ static unsigned int calc_timestamp(struct chan_iax2_pvt *p, unsigned int ts, str
 	p->lastsent = ms;
 	if (voice)
 		p->nextpred = p->nextpred + f->samples / 8;
-#if 0
-	printf("TS: %s - %dms\n", voice ? "Audio" : "Control", ms);
-#endif	
 	return ms;
 }
 
diff --git a/res/res_agi.c b/res/res_agi.c
index 30bfe289423f38a74fb4e6486d3f75a79dd68ca5..7caa4c96de41e300bbc79eeb3072423eab68b640 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -1784,11 +1784,6 @@ static int agi_handle_command(struct ast_channel *chan, AGI *agi, char *buf)
 	agi_command *c;
 
 	parse_args(buf, &argc, argv);
-#if	0
-	{ int x;
-	for (x=0; x<argc; x++) 
-		fprintf(stderr, "Got Arg%d: %s\n", x, argv[x]); }
-#endif
 	c = find_command(argv, 0);
 	if (c) {
 		res = c->handler(chan, agi, argc, argv);
diff --git a/utils.c b/utils.c
index 74d4854c40cee0bc34dbcf8763e213eb0380ef69..719d8685c9c9510b54b1359b767c2b6ef09e60c8 100644
--- a/utils.c
+++ b/utils.c
@@ -422,14 +422,6 @@ static void base64_init(void)
 	base64[63] = '/';
 	b2a[(int)'+'] = 62;
 	b2a[(int)'/'] = 63;
-#if 0
-	for (x=0;x<64;x++) {
-		if (b2a[(int)base64[x]] != x) {
-			fprintf(stderr, "!!! %d failed\n", x);
-		} else
-			fprintf(stderr, "--- %d passed\n", x);
-	}
-#endif
 }
 
 /*! \brief  ast_uri_encode: Turn text string to URI-encoded %XX version