diff --git a/.gitattributes b/.gitattributes
index c19c5cf042b557bbc609ef74745382f0d592dc86..8ebb9bec626c2920cc37908c4d5345ec23b2ec64 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -50,28 +50,16 @@ demos/demo.jan_21_2011/ps_demo.sh -text
 demos/demo.jan_21_2011/run_gdb.sh -text
 demos/demo.jan_21_2011/test_infinite.sh -text
 dyna_examples/Makefile -text
-dyna_examples/awk.stock -text
 dyna_examples/block_copy.c -text
-dyna_examples/bzip2.stock -text
-dyna_examples/cal.stock -text
-dyna_examples/cat.stock -text
-dyna_examples/clear.stock -text
 dyna_examples/cmd_args_005.c -text
 dyna_examples/concolic_test_handshake.c -text
 dyna_examples/data.txt -text
-dyna_examples/date.stock -text
-dyna_examples/df.stock -text
-dyna_examples/diff.stock -text
-dyna_examples/du.stock -text
 dyna_examples/dumbledore_cmd.c -text
 dyna_examples/dumbledore_file.c -text
 dyna_examples/dumbledore_file_with_fopen_check.c -text
 dyna_examples/dumbledore_stdin.c -text
-dyna_examples/expr.stock -text
-dyna_examples/find.stock -text
 dyna_examples/fptest.c -text
 dyna_examples/globalfield.c -text
-dyna_examples/grep.stock -text
 dyna_examples/hanoi.c -text
 dyna_examples/hanoi_heap_overrun.c -text
 dyna_examples/hanoi_nostrata.c -text
@@ -80,23 +68,11 @@ dyna_examples/hanoi_overrun_tainted.c -text
 dyna_examples/hanoi_overrun_taintedenv.c -text
 dyna_examples/hanoi_stack_overrun.c -text
 dyna_examples/hello.c -text
-dyna_examples/hostname.stock -text
-dyna_examples/ipcs.stock -text
-dyna_examples/less.stock -text
-dyna_examples/ls.stock -text
 dyna_examples/malloc.c -text
 dyna_examples/memcpy.c -text
 dyna_examples/myhanoi.c -text
-dyna_examples/nasm.stock -text
-dyna_examples/objdump.stock -text
 dyna_examples/print_ptr.c -text
-dyna_examples/ps.stock -text
 dyna_examples/recover_example.c -text
-dyna_examples/sdiff.stock -text
-dyna_examples/wc.stock -text
-dyna_examples/whoami.stock -text
-dyna_examples/xcalc.stock -text
-dyna_examples/xeyes.stock -text
 examples/Makefile -text
 examples/block_copy.c -text
 examples/cmd_args_005.c -text
@@ -122,6 +98,31 @@ examples/memcpy.c -text
 examples/myhanoi.c -text
 examples/print_ptr.c -text
 examples/recover_example.c -text
+stock_examples/Makefile -text
+stock_examples/awk.stock -text
+stock_examples/bzip2.stock -text
+stock_examples/cal.stock -text
+stock_examples/cat.stock -text
+stock_examples/clear.stock -text
+stock_examples/date.stock -text
+stock_examples/df.stock -text
+stock_examples/diff.stock -text
+stock_examples/du.stock -text
+stock_examples/expr.stock -text
+stock_examples/find.stock -text
+stock_examples/grep.stock -text
+stock_examples/hostname.stock -text
+stock_examples/ipcs.stock -text
+stock_examples/less.stock -text
+stock_examples/ls.stock -text
+stock_examples/nasm.stock -text
+stock_examples/objdump.stock -text
+stock_examples/ps.stock -text
+stock_examples/sdiff.stock -text
+stock_examples/wc.stock -text
+stock_examples/whoami.stock -text
+stock_examples/xcalc.stock -text
+stock_examples/xeyes.stock -text
 tools/cover.sh -text
 tools/db/drop_my_tables.sh -text
 tools/db/pdb.create.tbl -text
diff --git a/dyna_examples/Makefile b/dyna_examples/Makefile
index b259375157cd4808fb1e6fbc01aa5d17e71331b3..0a885a7b2753f53ace116bdbbac1c033a4a404b3 100644
--- a/dyna_examples/Makefile
+++ b/dyna_examples/Makefile
@@ -4,34 +4,35 @@
 
 CC=gcc
 CXX=g++
-CFLAGS=-O2
+CFLAGS=-O
+LD=gcc
 
-.SUFFIXES: .o .c .cpp .exe .stock .protected
+.SUFFIXES: .o .c .cpp .stock .protected
 
-exes=hanoi.exe hanoi_overrun.exe hanoi_heap_overrun.exe hanoi_stack_overrun.exe print_ptr.exe malloc.exe block_copy.exe hello.exe hanoi_overrun_tainted.exe hanoi_overrun_taintedenv.exe memcpy.exe cmd_args_005.exe dumbledore_stdin.exe dumbledore_cmd.exe dumbledore_file.exe
+exes=hanoi.protected hanoi_overrun.protected hanoi_heap_overrun.protected hanoi_stack_overrun.protected print_ptr.protected malloc.protected block_copy.protected hello.protected hanoi_overrun_tainted.protected hanoi_overrun_taintedenv.protected memcpy.protected cmd_args_005.protected dumbledore_stdin.protected dumbledore_cmd.protected dumbledore_file.protected
 
-protected_exes=awk.protected bzip2.protected cal.protected cat.protected clear.protected date.protected df.protected diff.protected du.protected expr.protected find.protected grep.protected hostname.protected ipcs.protected less.protected ls.protected nasm.protected objdump.protected ps.protected sdiff.protected wc.protected whoami.protected xeyes.protected xcalc.protected
+ilr=on
 
-all: env_check  ${exes}  ${protected_exes}
+all: env_check  ${exes}
 
 
 
 .PHONY: env_check 
 
-.stock.protected: .PHONY
-	${PEASOUP_HOME}/tools/ps_analyze.sh $< $@
 
-.o.exe: .PHONY
-	$(CC) $< -o $@ 
-	${PEASOUP_HOME}/tools/ps_analyze.sh  $@ $@
+.o.stock:
+	${PEASOUP_HOME}/tools/ps_link.sh $< -o $@ 
 
-.c.o: .PHONY
-	${CC} $<  -c
+.stock.protected:
+	${PEASOUP_HOME}/tools/ps_analyze.sh  $< $@ --step ilr=${ilr}
 
-.cpp.o: .PHONY
-	${CXX} $< 
+.c.o:
+	${PEASOUP_HOME}/tools/ps_comp.sh $< 
 
-chopzero: .PHONY
+.cpp.o:
+	${PEASOUP_HOME}/tools/ps_comp++.sh $< 
+
+chopzero:
 	@ if [ ! -f chopzero ]; then gcc chopzero.c -o chopzero -O3 ; fi
 
 $(exes): ${STRATA}/lib/x86_linux/libstrata.a
@@ -60,15 +61,13 @@ env_check:
 
 clean:
 	rm -f *.o *.syms *.map chopzero hanoi hanoi_overrun hanoi_heap_overrun malloc block_copy print_ptr hanoi_stack_overrun dumbledore a.out memcpy hanoi_overrun_taintedenv dumbledore_cmd hanoi_overrun_tainted hello cmd_args_005
-	rm -f *.exe *.dis *.data *.idb *.log *.ncexe *.annot *.readelf temp.* *.temp *.stratafied *.asm *.SMPobjdump *.id0 *.id1 *.til *.nam
+	rm -f *.exe *.dis *.data *.idb *.log *.ncexe *.annot *.readelf temp.* *.temp *.stratafied *.asm *.SMPobjdump *.id0 *.id1 *.til *.nam *.stock *.protected
 	rm -Rf concolic.files_*
 	rm -Rf peasoup_executable_directory.*
 	rm -f strata.log.*
 	rm -f *.sym
-	rm -f *.protected
 	if [ ! "X" = "X"${PGUSER} ]; then sh ../tools/db/drop_my_tables.sh; sh ../tools/db/pdb_setup.sh; fi
 
 concclean:
 	rm -Rf concolic.files_*
 	rm strata.log.*
-
diff --git a/dyna_examples/cmd_args_005.c b/dyna_examples/cmd_args_005.c
old mode 100755
new mode 100644
diff --git a/examples/Makefile b/examples/Makefile
index 9d8cd4afbe9689f81b46c1ca9408b9779ec234fa..72bbee29d1cf6a307002de57c390b03984e9a944 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -7,21 +7,21 @@ CXX=DO_NOT_USE
 CFLAGS=DO_NOT_USE
 LD=DO_NOT_USE
 
-.SUFFIXES: .o .c .cpp .exe
+.SUFFIXES: .o .c .cpp .stock .protected
 
-exes=hanoi.exe hanoi_overrun.exe hanoi_heap_overrun.exe hanoi_stack_overrun.exe print_ptr.exe malloc.exe block_copy.exe hello.exe hanoi_overrun_tainted.exe hanoi_overrun_taintedenv.exe memcpy.exe cmd_args_005.exe dumbledore_stdin.exe dumbledore_cmd.exe dumbledore_file.exe
+exes=hanoi.protected hanoi_overrun.protected hanoi_heap_overrun.protected hanoi_stack_overrun.protected print_ptr.protected malloc.protected block_copy.protected hello.protected hanoi_overrun_tainted.protected hanoi_overrun_taintedenv.protected memcpy.protected cmd_args_005.protected dumbledore_stdin.protected dumbledore_cmd.protected dumbledore_file.protected
 
+ilr=on
 
 all: env_check  ${exes}
 
-
-
 .PHONY: env_check 
 
-
-.o.exe:
+.o.stock:
 	${PEASOUP_HOME}/tools/ps_link.sh $< -o $@ 
-	${PEASOUP_HOME}/tools/ps_analyze.sh  $@ $@
+
+.stock.protected:
+	${PEASOUP_HOME}/tools/ps_analyze.sh  $< $@ --step ilr=${ilr}
 
 .c.o:
 	${PEASOUP_HOME}/tools/ps_comp.sh $< 
@@ -58,7 +58,7 @@ env_check:
 
 clean:
 	rm -f *.o *.syms *.map chopzero hanoi hanoi_overrun hanoi_heap_overrun malloc block_copy print_ptr hanoi_stack_overrun dumbledore a.out memcpy hanoi_overrun_taintedenv dumbledore_cmd hanoi_overrun_tainted hello cmd_args_005
-	rm -f *.exe *.dis *.data *.idb *.log *.ncexe *.annot *.readelf temp.* *.temp *.stratafied *.asm *.SMPobjdump *.id0 *.id1 *.til *.nam
+	rm -f *.exe *.dis *.data *.idb *.log *.ncexe *.annot *.readelf temp.* *.temp *.stratafied *.asm *.SMPobjdump *.id0 *.id1 *.til *.nam *.stock *.protected
 	rm -Rf concolic.files_*
 	rm -Rf peasoup_executable_directory.*
 	rm -f strata.log.*
diff --git a/examples/cmd_args_005.c b/examples/cmd_args_005.c
old mode 100755
new mode 100644
diff --git a/stock_examples/Makefile b/stock_examples/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..5e9943fbd95b2066e8bd73697051b6a2bc3f82ce
--- /dev/null
+++ b/stock_examples/Makefile
@@ -0,0 +1,58 @@
+
+CC=gcc
+CXX=g++
+CFLAGS=-O2
+ilr=on
+
+.SUFFIXES: .stock .protected
+
+protected_exes=awk.protected bzip2.protected cal.protected cat.protected clear.protected date.protected df.protected diff.protected du.protected expr.protected find.protected grep.protected hostname.protected ipcs.protected less.protected ls.protected nasm.protected objdump.protected ps.protected sdiff.protected wc.protected whoami.protected xeyes.protected xcalc.protected
+
+all: env_check  ${protected_exes}
+
+.PHONY: env_check 
+
+
+
+.stock.protected: .PHONY
+	${PEASOUP_HOME}/tools/ps_analyze.sh $< $@ --step ilr=${ilr}
+
+
+$(protected_exes): ${STRATA}/lib/x86_linux/libstrata.a
+
+
+
+env_check:
+	@echo checking env vars; \
+	if [ "X${TOOLCHAIN}" = "X" ]; then \
+		echo TOOLCHAIN environment variable should be set.; \
+		exit -1;\
+ 	elif [ "X${STRATA}" = "X" ]; then \
+		echo STRATA environment variable should be set. ;\
+		exit -1;\
+ 	elif [ "X${SMPSA_HOME}" = "X" ]; then \
+		echo SMPSA_HOME environment variable should be set.; \
+		exit -1;\
+ 	elif [ "X${PEASOUP_HOME}" = "X" ]; then \
+		echo PEASOUP_HOME environment variable should be set.; \
+		exit -1;\
+ 	elif [ "X${STRATA_HOME}" = "X" ]; then \
+		echo STRATA_HOME environment variable should be set.; \
+		exit -1;\
+	fi ; 
+
+
+clean:
+	rm -f *.o *.syms *.map chopzero hanoi hanoi_overrun hanoi_heap_overrun malloc block_copy print_ptr hanoi_stack_overrun dumbledore a.out memcpy hanoi_overrun_taintedenv dumbledore_cmd hanoi_overrun_tainted hello cmd_args_005
+	rm -f *.exe *.dis *.data *.idb *.log *.ncexe *.annot *.readelf temp.* *.temp *.stratafied *.asm *.SMPobjdump *.id0 *.id1 *.til *.nam
+	rm -Rf concolic.files_*
+	rm -Rf peasoup_executable_directory.*
+	rm -f strata.log.*
+	rm -f *.sym
+	rm -f *.protected
+	if [ ! "X" = "X"${PGUSER} ]; then sh ../tools/db/drop_my_tables.sh; sh ../tools/db/pdb_setup.sh; fi
+
+concclean:
+	rm -Rf concolic.files_*
+	rm strata.log.*
+
diff --git a/dyna_examples/awk.stock b/stock_examples/awk.stock
similarity index 100%
rename from dyna_examples/awk.stock
rename to stock_examples/awk.stock
diff --git a/dyna_examples/bzip2.stock b/stock_examples/bzip2.stock
similarity index 100%
rename from dyna_examples/bzip2.stock
rename to stock_examples/bzip2.stock
diff --git a/dyna_examples/cal.stock b/stock_examples/cal.stock
similarity index 100%
rename from dyna_examples/cal.stock
rename to stock_examples/cal.stock
diff --git a/dyna_examples/cat.stock b/stock_examples/cat.stock
similarity index 100%
rename from dyna_examples/cat.stock
rename to stock_examples/cat.stock
diff --git a/dyna_examples/clear.stock b/stock_examples/clear.stock
similarity index 100%
rename from dyna_examples/clear.stock
rename to stock_examples/clear.stock
diff --git a/dyna_examples/date.stock b/stock_examples/date.stock
similarity index 100%
rename from dyna_examples/date.stock
rename to stock_examples/date.stock
diff --git a/dyna_examples/df.stock b/stock_examples/df.stock
similarity index 100%
rename from dyna_examples/df.stock
rename to stock_examples/df.stock
diff --git a/dyna_examples/diff.stock b/stock_examples/diff.stock
similarity index 100%
rename from dyna_examples/diff.stock
rename to stock_examples/diff.stock
diff --git a/dyna_examples/du.stock b/stock_examples/du.stock
similarity index 100%
rename from dyna_examples/du.stock
rename to stock_examples/du.stock
diff --git a/dyna_examples/expr.stock b/stock_examples/expr.stock
similarity index 100%
rename from dyna_examples/expr.stock
rename to stock_examples/expr.stock
diff --git a/dyna_examples/find.stock b/stock_examples/find.stock
similarity index 100%
rename from dyna_examples/find.stock
rename to stock_examples/find.stock
diff --git a/dyna_examples/grep.stock b/stock_examples/grep.stock
similarity index 100%
rename from dyna_examples/grep.stock
rename to stock_examples/grep.stock
diff --git a/dyna_examples/hostname.stock b/stock_examples/hostname.stock
similarity index 100%
rename from dyna_examples/hostname.stock
rename to stock_examples/hostname.stock
diff --git a/dyna_examples/ipcs.stock b/stock_examples/ipcs.stock
similarity index 100%
rename from dyna_examples/ipcs.stock
rename to stock_examples/ipcs.stock
diff --git a/dyna_examples/less.stock b/stock_examples/less.stock
similarity index 100%
rename from dyna_examples/less.stock
rename to stock_examples/less.stock
diff --git a/dyna_examples/ls.stock b/stock_examples/ls.stock
similarity index 100%
rename from dyna_examples/ls.stock
rename to stock_examples/ls.stock
diff --git a/dyna_examples/nasm.stock b/stock_examples/nasm.stock
similarity index 100%
rename from dyna_examples/nasm.stock
rename to stock_examples/nasm.stock
diff --git a/dyna_examples/objdump.stock b/stock_examples/objdump.stock
similarity index 100%
rename from dyna_examples/objdump.stock
rename to stock_examples/objdump.stock
diff --git a/dyna_examples/ps.stock b/stock_examples/ps.stock
similarity index 100%
rename from dyna_examples/ps.stock
rename to stock_examples/ps.stock
diff --git a/dyna_examples/sdiff.stock b/stock_examples/sdiff.stock
similarity index 100%
rename from dyna_examples/sdiff.stock
rename to stock_examples/sdiff.stock
diff --git a/dyna_examples/wc.stock b/stock_examples/wc.stock
similarity index 100%
rename from dyna_examples/wc.stock
rename to stock_examples/wc.stock
diff --git a/dyna_examples/whoami.stock b/stock_examples/whoami.stock
similarity index 100%
rename from dyna_examples/whoami.stock
rename to stock_examples/whoami.stock
diff --git a/dyna_examples/xcalc.stock b/stock_examples/xcalc.stock
similarity index 100%
rename from dyna_examples/xcalc.stock
rename to stock_examples/xcalc.stock
diff --git a/dyna_examples/xeyes.stock b/stock_examples/xeyes.stock
similarity index 100%
rename from dyna_examples/xeyes.stock
rename to stock_examples/xeyes.stock
diff --git a/tools/ps_analyze.sh b/tools/ps_analyze.sh
index 2cff168335a6fc66cae80720d8b59c354561ed00..196060816885dc81c2ae681d2e2269aeb53020e4 100755
--- a/tools/ps_analyze.sh
+++ b/tools/ps_analyze.sh
@@ -8,6 +8,16 @@
 #     peasoup_analyze.sh <original_binary> <new_binary> <options>
 #
 
+check_step_option()
+{
+	echo $1|egrep "=off$|=on$" > /dev/null
+	if [ $? -ne 0 ]; then
+		echo Malformed option: $1;
+		exit -4;
+	fi
+	
+}
+
 
 #
 # check that the remaining options are validly parsable, and record what they are.
@@ -16,11 +26,44 @@ check_options()
 {
 
 	# 
-	# fill in better option parsing later.
-	#
+	# loop to process options.
+	# 
+
+	# Note that we use `"$@"' to let each command-line parameter expand to a 
+	# separate word. The quotes around `$@' are essential!
+	# We need TEMP as the `eval set --' would nuke the return value of getopt.
+	TEMP=`getopt -o s: --long step: -n 'ps_analyze.sh' -- "$@"`
+
+	# error check #
+	if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit -1 ; fi
+
+	# Note the quotes around `$TEMP': they are essential!
+	eval set -- "$TEMP"
+
+	while true ; do
+		case "$1" in
+		-s|--step) 
+			echo "found option --step with argument $2"
+			check_step_option $2
+			phases_off=" $phases_off $2 "
+			shift 2 
+			;;
+		--) 	shift 
+			break 
+			;;
+		*) 	echo "Internal error!" 
+		 	exit -2 
+			;;
+		esac
+	done
+
+	# report errors if found
 	if [ ! -z $1 ]; then
-		echo Cannot parse option $1
-		exit 1
+		echo Unparsed parameters:
+	fi
+	for arg do echo '--> '"\`$arg'" ; done
+	if [ ! -z $1 ]; then
+		exit -3;	
 	fi
 	
 }
@@ -31,19 +74,75 @@ check_options()
 #
 is_step_on()
 {
-	# for now, all steps are on 
+	step=$1
+
+	echo $phases_off|egrep "$step=off" > /dev/null
+	if [ $? -eq 0 ] ; then
+		return 0
+	fi
+
+	# for now, all steps are on unless explicitly set to off
 	return 1
 }
 
 #
-# get_step_error_code
+# is_step_error decide based on the step (in $1) and the exit code (in $2) if there was a failure.
 #
 is_step_error()
 {
-	#
-	# fill in with better info later
-	#
-	return 0
+	my_step=$1
+	my_error=$2
+
+
+	case $my_step in
+		# registering the program should return the variant ID, 0 or negative is error.
+		pdb_register)
+			if [ $my_error -gt 0 ]; then
+				return 0;
+			fi
+			return 1;
+		;;
+		# cloning the program should return the variant ID, 0 or negative is error.
+		clone)
+			if [ $my_error -gt 0 ]; then
+				return 0;
+			fi
+			return 1;
+		;;
+		*)
+			if [ $my_error -eq 0 ]; then
+				# if not otherwise specified, programs should return 0
+				return 0;
+			fi
+			return 1;
+	esac
+}
+
+#
+# return the severity of the error for the step in $1
+#
+stop_if_error()
+{
+	my_step=$1
+
+
+	case $my_step in
+		# getting the annotation file right is necessary-ish
+		meds_static)
+			return 1;
+		;;
+		# registering the program is necessary 
+		pdb_register)
+			return 2;
+		;;
+		# cloning is necessary 
+		clone)
+			return 3;
+		;;
+		# other steps are optional
+		*)
+			return 0;
+	esac
 }
 
 #
@@ -57,6 +156,7 @@ perform_step()
 
 	is_step_on $step
 	if [ $? -eq 0 ]; then 
+		echo Skipping step $step.
 		return 0
 	fi
 
@@ -74,11 +174,16 @@ perform_step()
 		command_exit=$?
 	fi
 	
-	echo command exit status for step $step is $command_exit
-
 	is_step_error $step $command_exit
 	if [ $? -ne 0 ]; then
-		echo command failed!
+		echo Done.  Command failed!
+
+		# check if we need to exit
+		stop_if_error $step
+		if [ $? -lt $error_threshold ]; then 
+			echo The $step step is necessary, but failed.  Exiting ps_analyze early.
+			exit -1;
+		fi
 	else
 		echo Done.  Successful.
 	fi
@@ -174,9 +279,6 @@ check_files()
 
 }
 
-
-ps_starttime=`date`
-
 #
 # turn on debugging output if it's requested.
 #
@@ -185,6 +287,18 @@ if [ ! -z "$VERBOSE" ]; then
 fi
 
 
+#
+# set the threshold value.  if a step errors with a more severe error (1=most severe, >1 lesser severe)
+# than the error_threshold, we exit.
+#
+error_threshold=1
+
+#
+# record when we started processing:
+#
+ps_starttime=`date`
+
+
 #
 # stepnum used for counting how many steps peasoup executes
 # 
@@ -307,6 +421,10 @@ if [ -f $newname.ncexe.annot  -a $varid -gt 0 ]; then
 	perform_step clone $SECURITY_TRANSFORMS_HOME/libIRDB/test/clone.exe $varid				
 	cloneid=$?
 
+	
+	#	
+	# we could skip this check and simplify ps_analyze if we say that cloning is necessary in is_step_error
+	#
 	if [ $cloneid -gt 0 ]; then
 		# do the basic tranforms we're performing for peasoup 
 		perform_step fix_calls $SECURITY_TRANSFORMS_HOME/libIRDB/test/fix_calls.exe $cloneid	
diff --git a/tools/ps_link.sh b/tools/ps_link.sh
index 40badae702b4b2b2b28dc30a9e1ad267a7ba9eb8..cca5a5cd38ec2c505aebcf2bcfc89b00b537fb29 100755
--- a/tools/ps_link.sh
+++ b/tools/ps_link.sh
@@ -6,7 +6,7 @@
 #
 for i in $*
 do
-	echo $i|egrep "^-";	# check for starting with a - 
+	echo $i|egrep "^-" > /dev/null;	# check for starting with a - 
 	if [ 0 -eq  $? ] ; then 
 		echo $i|egrep "^-o" > /dev/null;	# check for starting with a -o 
 		dasho=$?