Index: src/ControlStruct/LabelFixer.cc
===================================================================
--- src/ControlStruct/LabelFixer.cc	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/ControlStruct/LabelFixer.cc	(revision be5aa1bdda2dce427692030b8a71558b7cec35cb)
@@ -9,7 +9,7 @@
 // Author           : Rodolfo G. Esteves
 // Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue May 19 15:25:59 2015
-// Update Count     : 1
+// Last Modified By : Rob Schluntz
+// Last Modified On : Wed May 27 16:16:14 2015
+// Update Count     : 4
 //
 
@@ -40,6 +40,5 @@
 
 	void LabelFixer::visit( FunctionDecl *functionDecl ) {
-		if ( functionDecl->get_statements() != 0 )
-			functionDecl->get_statements()->accept( *this );
+		maybeAccept( functionDecl->get_statements(), *this );
 
 		MLEMutator mlemut( resolveJumps(), generator );
@@ -102,9 +101,10 @@
 			Entry *e = i->second;
 
-			if ( def_us.find ( e->get_definition() ) == def_us.end() )
-				def_us[ e->get_definition() ] = e;
-			else
+			if ( def_us.find ( e->get_definition() ) == def_us.end() ) {
+				def_us[ e->get_definition() ] = e;				
+			} else {
 				if ( e->used() )
 					def_us[ e->get_definition() ]->add_uses( e->get_uses() );
+			}
 		}
 
Index: src/ControlStruct/LabelFixer.h
===================================================================
--- src/ControlStruct/LabelFixer.h	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/ControlStruct/LabelFixer.h	(revision be5aa1bdda2dce427692030b8a71558b7cec35cb)
@@ -9,7 +9,7 @@
 // Author           : Rodolfo G. Esteves
 // Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue May 19 15:31:55 2015
-// Update Count     : 3
+// Last Modified By : Rob Schluntz
+// Last Modified On : Tue May 26 12:55:10 2015
+// Update Count     : 4
 //
 
@@ -66,13 +66,12 @@
 
 			Label get_label() const { return label; }
+			void set_label( Label lab ) { label = lab; }
+
 			Statement *get_definition() const { return definition; }
+			void set_definition( Statement *def ) { definition = def; }
+
 			std::list< Statement *> &get_uses() { return usage; }
-
 			void add_use ( Statement *use ) { usage.push_back( use ); }
 			void add_uses ( std::list<Statement *> uses ) { usage.insert( usage.end(), uses.begin(), uses.end() ); }
-			void set_definition( Statement *def ) { definition = def; }
-
-			void set_label( Label lab ) { label = lab; }
-			Label gset_label() const { return label; }
 		  private:
 			Label label;  
Index: src/ControlStruct/MLEMutator.cc
===================================================================
--- src/ControlStruct/MLEMutator.cc	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/ControlStruct/MLEMutator.cc	(revision be5aa1bdda2dce427692030b8a71558b7cec35cb)
@@ -9,7 +9,7 @@
 // Author           : Rodolfo G. Esteves
 // Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue May 19 15:32:26 2015
-// Update Count     : 2
+// Last Modified By : Rob Schluntz
+// Last Modified On : Wed May 27 16:19:32 2015
+// Update Count     : 44
 //
 
@@ -28,5 +28,5 @@
 	CompoundStmt* MLEMutator::mutate( CompoundStmt *cmpndStmt ) {
 		bool labeledBlock = false;
-		if ( !((cmpndStmt->get_labels()).empty()) ) {
+		if ( !(cmpndStmt->get_labels().empty()) ) {
 			labeledBlock = true;
 			enclosingBlocks.push_back( Entry( cmpndStmt ) );
@@ -42,6 +42,7 @@
 					std::list<Label> ls; ls.push_back( get_breakLabel() );
 					kids.push_back( new NullStmt( ls ) );
-				} else
+				} else {
 					(*next)->get_labels().push_back( get_breakLabel() );
+				}
 
 				set_breakLabel("");
@@ -51,6 +52,7 @@
 		if ( labeledBlock ) {
 			assert( ! enclosingBlocks.empty() );
-			if ( ! enclosingBlocks.back().get_breakExit().empty() )
+			if ( ! enclosingBlocks.back().get_breakExit().empty() ) {
 				set_breakLabel( enclosingBlocks.back().get_breakExit() );
+			}
 			enclosingBlocks.pop_back();
 		} // if
@@ -85,10 +87,17 @@
 
 	Statement *MLEMutator::mutate( BranchStmt *branchStmt ) throw ( SemanticError ) {
+		std::string originalTarget = branchStmt->get_originalTarget();
+
 		if ( branchStmt->get_type() == BranchStmt::Goto )
 			return branchStmt;
 
 		// test if continue target is a loop
-		if ( branchStmt->get_type() == BranchStmt::Continue && enclosingLoops.empty() )
-			throw SemanticError( "'continue' outside a loop" );
+		if ( branchStmt->get_type() == BranchStmt::Continue) {
+			if ( enclosingLoops.empty() ) {
+				throw SemanticError( "'continue' outside a loop" );
+			} else if ( std::find( enclosingLoops.begin(), enclosingLoops.end(), (*targetTable)[branchStmt->get_target()] ) == enclosingLoops.end() ) {
+				throw SemanticError( "'continue' target label must be an enclosing loop: " + originalTarget );
+			}
+		}
 
 		if ( branchStmt->get_type() == BranchStmt::Break && (enclosingLoops.empty() && enclosingSwitches.empty() && enclosingBlocks.empty() ) )
@@ -98,5 +107,5 @@
 
 		if ( targetTable->find( branchStmt->get_target() ) == targetTable->end() )
-			throw SemanticError("The label defined in the exit loop statement does not exist." );  // shouldn't happen (since that's already checked)
+			throw SemanticError("The label defined in the exit loop statement does not exist: " + originalTarget );  // shouldn't happen (since that's already checked)
 
 		std::list< Entry >::iterator check;
@@ -106,5 +115,5 @@
 				// neither in loop nor in block, checking if in switch/choose
 				if ( (check = std::find( enclosingSwitches.begin(), enclosingSwitches.end(), (*targetTable)[branchStmt->get_target()] )) == enclosingSwitches.end() )
-					throw SemanticError("The target specified in the exit loop statement does not correspond to an enclosing loop.");
+					throw SemanticError("The target specified in the exit loop statement does not correspond to an enclosing control structure: " + originalTarget );
 
 		if ( enclosingLoops.back() == (*check) )
@@ -114,21 +123,21 @@
 		switch ( branchStmt->get_type() ) {
 		  case BranchStmt::Break:
-			if ( check->get_breakExit() != "" )
-				newLabel = check->get_breakExit();
-			else {
-				newLabel = generator->newLabel();
-				check->set_breakExit( newLabel );
-			} // if
-			break;
+				if ( check->get_breakExit() != "" ) {
+					newLabel = check->get_breakExit();
+				} else {
+					newLabel = generator->newLabel();
+					check->set_breakExit( newLabel );
+				} // if
+				break;
 		  case BranchStmt::Continue:
-			if ( check->get_contExit() != "" )
-				newLabel = check->get_contExit();
-			else {
-				newLabel = generator->newLabel();
-				check->set_contExit( newLabel );
-			} // if
-			break;
+				if ( check->get_contExit() != "" ) {
+					newLabel = check->get_contExit();
+				} else {
+					newLabel = generator->newLabel();
+					check->set_contExit( newLabel );
+				} // if
+				break;
 		  default:
-			return 0;					// shouldn't be here
+				return 0;					// shouldn't be here
 		} // switch
 
@@ -136,9 +145,14 @@
 	}
 
-
-	Statement *MLEMutator::mutate( SwitchStmt *switchStmt ) {
+	template< typename SwitchClass >
+	Statement *handleSwitchStmt( SwitchClass *switchStmt, MLEMutator &mutator ) {
+		// set up some aliases so that the rest of the code isn't messy
+		typedef MLEMutator::Entry Entry;
+		LabelGenerator *generator = mutator.generator;
+		std::list< Entry > &enclosingSwitches = mutator.enclosingSwitches;
+
 		Label brkLabel = generator->newLabel();
 		enclosingSwitches.push_back( Entry(switchStmt, "", brkLabel) );
-		mutateAll( switchStmt->get_branches(), *this ); {
+		mutateAll( switchStmt->get_branches(), mutator ); {
 			// check if this is necessary (if there is a break to this point, otherwise do not generate
 			std::list<Label> temp; temp.push_back( brkLabel );
@@ -150,15 +164,10 @@
 	}
 
+	Statement *MLEMutator::mutate( SwitchStmt *switchStmt ) {
+		return handleSwitchStmt( switchStmt, *this );
+	}
+
 	Statement *MLEMutator::mutate( ChooseStmt *switchStmt ) {
-		Label brkLabel = generator->newLabel();
-		enclosingSwitches.push_back( Entry(switchStmt,"", brkLabel) );
-		mutateAll( switchStmt->get_branches(), *this ); {
-			// check if this is necessary (if there is a break to this point, otherwise do not generate
-			std::list<Label> temp; temp.push_back( brkLabel );
-			switchStmt->get_branches().push_back( new BranchStmt( temp, Label(""), BranchStmt::Break ) );
-		}
-		assert ( enclosingSwitches.back() == switchStmt );
-		enclosingSwitches.pop_back();
-		return switchStmt;
+		return handleSwitchStmt( switchStmt, *this );		
 	}
 
Index: src/ControlStruct/MLEMutator.h
===================================================================
--- src/ControlStruct/MLEMutator.h	(revision 843054c23fcb725d2486e5e42e91b3741bc523b8)
+++ src/ControlStruct/MLEMutator.h	(revision be5aa1bdda2dce427692030b8a71558b7cec35cb)
@@ -9,7 +9,7 @@
 // Author           : Rodolfo G. Esteves
 // Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue May 19 15:32:39 2015
-// Update Count     : 3
+// Last Modified By : Rob Schluntz
+// Last Modified On : Tue May 26 15:04:21 2015
+// Update Count     : 7
 //
 
@@ -75,4 +75,7 @@
 		Label breakLabel;
 		LabelGenerator *generator;
+
+		template< typename SwitchClass > 
+		friend Statement *handleSwitchStmt( SwitchClass *switchStmt, MLEMutator &mutator );
 	};
 } // namespace ControlStruct
