Index: src/InitTweak/InitTweak.cc
===================================================================
--- src/InitTweak/InitTweak.cc	(revision 85dac33f47b97046aafe89719ccb94143075c733)
+++ src/InitTweak/InitTweak.cc	(revision 884f14097e02f66e09356b478c49b4c0cd96149a)
@@ -9,7 +9,7 @@
 // Author           : Rob Schluntz
 // Created On       : Fri May 13 11:26:36 2016
-// Last Modified By : Aaron B. Moss
-// Last Modified On : Mon Jun 10 13:30:00 2019
-// Update Count     : 5
+// Last Modified By : Andrew Beach
+// Last Modified On : Fri Jun 19 14:34:00 2019
+// Update Count     : 6
 //
 
@@ -633,13 +633,21 @@
 			return nullptr;
 		}
+
+		DeclarationWithType * getFunctionCore( const Expression * expr ) {
+			if ( const auto * appExpr = dynamic_cast< const ApplicationExpr * >( expr ) ) {
+				return getCalledFunction( appExpr->function );
+			} else if ( const auto * untyped = dynamic_cast< const UntypedExpr * >( expr ) ) {
+				return getCalledFunction( untyped->function );
+			}
+			assertf( false, "getFunction with unknown expression: %s", toString( expr ).c_str() );
+		}
 	}
 
 	DeclarationWithType * getFunction( Expression * expr ) {
-		if ( ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( expr ) ) {
-			return getCalledFunction( appExpr->get_function() );
-		} else if ( UntypedExpr * untyped = dynamic_cast< UntypedExpr * > ( expr ) ) {
-			return getCalledFunction( untyped->get_function() );
-		}
-		assertf( false, "getFunction received unknown expression: %s", toString( expr ).c_str() );
+		return getFunctionCore( expr );
+	}
+
+	const DeclarationWithType * getFunction( const Expression * expr ) {
+		return getFunctionCore( expr );
 	}
 
Index: src/InitTweak/InitTweak.h
===================================================================
--- src/InitTweak/InitTweak.h	(revision 85dac33f47b97046aafe89719ccb94143075c733)
+++ src/InitTweak/InitTweak.h	(revision 884f14097e02f66e09356b478c49b4c0cd96149a)
@@ -9,7 +9,7 @@
 // Author           : Rob Schluntz
 // Created On       : Fri May 13 11:26:36 2016
-// Last Modified By : Aaron B. Moss
-// Last Modified On : Mon Jun 10 13:30:00 2019
-// Update Count     : 5
+// Last Modified By : Andrew Beach
+// Last Modified On : Fri Jul 19 14:18:00 2019
+// Update Count     : 6
 //
 
@@ -61,4 +61,5 @@
 	/// returns the declaration of the function called by the expr (must be ApplicationExpr or UntypedExpr)
 	DeclarationWithType * getFunction( Expression * expr );
+	const DeclarationWithType * getFunction( const Expression * expr );
 	const ast::DeclWithType * getFunction( const ast::Expr * expr );
 
Index: src/Tuples/TupleExpansion.cc
===================================================================
--- src/Tuples/TupleExpansion.cc	(revision 85dac33f47b97046aafe89719ccb94143075c733)
+++ src/Tuples/TupleExpansion.cc	(revision 884f14097e02f66e09356b478c49b4c0cd96149a)
@@ -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 : Wed Feb 13 18:14:12 2019
-// Update Count     : 21
+// Last Modified By : Andrew Beach
+// Last Modified On : Fri Jul 19 14:39:00 2019
+// Update Count     : 22
 //
 
@@ -364,9 +364,9 @@
 			ImpurityDetector( bool ignoreUnique ) : ignoreUnique( ignoreUnique ) {}
 
-			void previsit( ApplicationExpr * appExpr ) {
+			void previsit( const ApplicationExpr * appExpr ) {
 				visit_children = false;
-				if ( DeclarationWithType * function = InitTweak::getFunction( appExpr ) ) {
-					if ( function->get_linkage() == LinkageSpec::Intrinsic ) {
-						if ( function->get_name() == "*?" || function->get_name() == "?[?]" ) {
+				if ( const DeclarationWithType * function = InitTweak::getFunction( appExpr ) ) {
+					if ( function->linkage == LinkageSpec::Intrinsic ) {
+						if ( function->name == "*?" || function->name == "?[?]" ) {
 							// intrinsic dereference, subscript are pure, but need to recursively look for impurity
 							visit_children = true;
@@ -377,6 +377,6 @@
 				maybeImpure = true;
 			}
-			void previsit( UntypedExpr * ) { maybeImpure = true; visit_children = false; }
-			void previsit( UniqueExpr * ) {
+			void previsit( const UntypedExpr * ) { maybeImpure = true; visit_children = false; }
+			void previsit( const UniqueExpr * ) {
 				if ( ignoreUnique ) {
 					// bottom out at unique expression.
@@ -393,5 +393,5 @@
 	} // namespace
 
-	bool maybeImpure( Expression * expr ) {
+	bool maybeImpure( const Expression * expr ) {
 		PassVisitor<ImpurityDetector> detector( false );
 		expr->accept( detector );
@@ -399,5 +399,5 @@
 	}
 
-	bool maybeImpureIgnoreUnique( Expression * expr ) {
+	bool maybeImpureIgnoreUnique( const Expression * expr ) {
 		PassVisitor<ImpurityDetector> detector( true );
 		expr->accept( detector );
Index: src/Tuples/Tuples.h
===================================================================
--- src/Tuples/Tuples.h	(revision 85dac33f47b97046aafe89719ccb94143075c733)
+++ src/Tuples/Tuples.h	(revision 884f14097e02f66e09356b478c49b4c0cd96149a)
@@ -55,10 +55,10 @@
 
 	/// returns true if the expression may contain side-effects.
-	bool maybeImpure( Expression * expr );
+	bool maybeImpure( const Expression * expr );
 	bool maybeImpure( const ast::Expr * expr );
 
 	/// Returns true if the expression may contain side-effect,
 	/// ignoring the presence of unique expressions.
-	bool maybeImpureIgnoreUnique( Expression * expr );
+	bool maybeImpureIgnoreUnique( const Expression * expr );
 	bool maybeImpureIgnoreUnique( const ast::Expr * expr );
 } // namespace Tuples
