Index: src/AST/Pass.impl.hpp
===================================================================
--- src/AST/Pass.impl.hpp	(revision 720f2fe263de46a16198a07023bfeb3b7cbe8876)
+++ src/AST/Pass.impl.hpp	(revision a8b87d3db4fd7828fac5029e592eb07f8b87bcb6)
@@ -182,8 +182,8 @@
 
 		// get the stmts/decls that will need to be spliced in
-		auto stmts_before = __pass::stmtsToAddBefore( core, 0);
-		auto stmts_after  = __pass::stmtsToAddAfter ( core, 0);
-		auto decls_before = __pass::declsToAddBefore( core, 0);
-		auto decls_after  = __pass::declsToAddAfter ( core, 0);
+		auto stmts_before = __pass::stmtsToAddBefore( core, 0 );
+		auto stmts_after  = __pass::stmtsToAddAfter ( core, 0 );
+		auto decls_before = __pass::declsToAddBefore( core, 0 );
+		auto decls_after  = __pass::declsToAddAfter ( core, 0 );
 
 		// These may be modified by subnode but most be restored once we exit this statemnet.
@@ -317,6 +317,4 @@
 				assert(( empty( stmts_before ) && empty( stmts_after ))
 				    || ( empty( decls_before ) && empty( decls_after )) );
-
-
 
 				// Take all the statements which should have gone after, N/A for first iteration
@@ -2115,6 +2113,6 @@
 	if ( __visit_children() ) {
 		bool mutated = false;
-		std::unordered_map< ast::TypeInstType::TypeEnvKey, ast::ptr< ast::Type > > new_map;
-		for ( const auto & p : node->typeEnv ) {
+		ast::TypeSubstitution::TypeMap new_map;
+		for ( const auto & p : node->typeMap ) {
 			guard_symtab guard { *this };
 			auto new_node = p.second->accept( *this );
@@ -2124,5 +2122,5 @@
 		if (mutated) {
 			auto new_node = __pass::mutate<core_t>( node );
-			new_node->typeEnv.swap( new_map );
+			new_node->typeMap.swap( new_map );
 			node = new_node;
 		}
Index: src/AST/TypeSubstitution.cpp
===================================================================
--- src/AST/TypeSubstitution.cpp	(revision 720f2fe263de46a16198a07023bfeb3b7cbe8876)
+++ src/AST/TypeSubstitution.cpp	(revision a8b87d3db4fd7828fac5029e592eb07f8b87bcb6)
@@ -38,43 +38,44 @@
 
 void TypeSubstitution::initialize( const TypeSubstitution &src, TypeSubstitution &dest ) {
-	dest.typeEnv.clear();
+	dest.typeMap.clear();
 	dest.add( src );
 }
 
 void TypeSubstitution::add( const TypeSubstitution &other ) {
-	for ( TypeEnvType::const_iterator i = other.typeEnv.begin(); i != other.typeEnv.end(); ++i ) {
-		typeEnv[ i->first ] = i->second;
+	for ( TypeMap::const_iterator i = other.typeMap.begin(); i != other.typeMap.end(); ++i ) {
+		typeMap[ i->first ] = i->second;
 	} // for
 }
 
 void TypeSubstitution::add( const TypeInstType * formalType, const Type *actualType ) {
-	typeEnv[ *formalType ] = actualType;
+	typeMap[ *formalType ] = actualType;
 }
 
 void TypeSubstitution::add( const TypeInstType::TypeEnvKey & key, const Type * actualType) {
-	typeEnv[ key ] = actualType;
+	typeMap[ key ] = actualType;
 }
 
 void TypeSubstitution::remove( const TypeInstType * formalType ) {
-	TypeEnvType::iterator i = typeEnv.find( *formalType );
-	if ( i != typeEnv.end() ) {
-		typeEnv.erase( *formalType );
-	} // if
-}
-
-const Type *TypeSubstitution::lookup( const TypeInstType * formalType ) const {
-	TypeEnvType::const_iterator i = typeEnv.find( *formalType );
+	TypeMap::iterator i = typeMap.find( *formalType );
+	if ( i != typeMap.end() ) {
+		typeMap.erase( *formalType );
+	} // if
+}
+
+const Type *TypeSubstitution::lookup(
+		const TypeInstType::TypeEnvKey & formalType ) const {
+	TypeMap::const_iterator i = typeMap.find( formalType );
 
 	// break on not in substitution set
-	if ( i == typeEnv.end() ) return 0;
+	if ( i == typeMap.end() ) return 0;
 
 	// attempt to transitively follow TypeInstType links.
 	while ( const TypeInstType *actualType = i->second.as<TypeInstType>()) {
 		// break cycles in the transitive follow
-		if ( *formalType == *actualType ) break;
+		if ( formalType == *actualType ) break;
 
 		// Look for the type this maps to, returning previous mapping if none-such
-		i = typeEnv.find( *actualType );
-		if ( i == typeEnv.end() ) return actualType;
+		i = typeMap.find( *actualType );
+		if ( i == typeMap.end() ) return actualType;
 	}
 
@@ -83,6 +84,10 @@
 }
 
+const Type *TypeSubstitution::lookup( const TypeInstType * formalType ) const {
+	return lookup( ast::TypeInstType::TypeEnvKey( *formalType ) );
+}
+
 bool TypeSubstitution::empty() const {
-	return typeEnv.empty();
+	return typeMap.empty();
 }
 
@@ -119,5 +124,5 @@
 		sub.core.subCount = 0;
 		sub.core.freeOnly = true;
-		for ( TypeEnvType::iterator i = typeEnv.begin(); i != typeEnv.end(); ++i ) {
+		for ( TypeMap::iterator i = typeMap.begin(); i != typeMap.end(); ++i ) {
 			i->second = i->second->accept( sub );
 		}
@@ -129,6 +134,6 @@
 	if ( bound != boundVars.end() ) return inst;
 
-	TypeEnvType::const_iterator i = sub.typeEnv.find( *inst );
-	if ( i == sub.typeEnv.end() ) {
+	TypeMap::const_iterator i = sub.typeMap.find( *inst );
+	if ( i == sub.typeMap.end() ) {
 		return inst;
 	} else {
Index: src/AST/TypeSubstitution.hpp
===================================================================
--- src/AST/TypeSubstitution.hpp	(revision 720f2fe263de46a16198a07023bfeb3b7cbe8876)
+++ src/AST/TypeSubstitution.hpp	(revision a8b87d3db4fd7828fac5029e592eb07f8b87bcb6)
@@ -75,4 +75,5 @@
 	void add( const TypeSubstitution &other );
 	void remove( const TypeInstType * formalType );
+	const Type *lookup( const TypeInstType::TypeEnvKey & formalType ) const;
 	const Type *lookup( const TypeInstType * formalType ) const;
 	bool empty() const;
@@ -104,13 +105,13 @@
 	friend class Pass;
 
-	typedef std::unordered_map< TypeInstType::TypeEnvKey, ptr<Type> > TypeEnvType;
-	TypeEnvType typeEnv;
+	typedef std::unordered_map< TypeInstType::TypeEnvKey, ptr<Type> > TypeMap;
+	TypeMap typeMap;
 
   public:
-	// has to come after declaration of typeEnv
-	auto begin()       -> decltype( typeEnv.begin() ) { return typeEnv.begin(); }
-	auto   end()       -> decltype( typeEnv.  end() ) { return typeEnv.  end(); }
-	auto begin() const -> decltype( typeEnv.begin() ) { return typeEnv.begin(); }
-	auto   end() const -> decltype( typeEnv.  end() ) { return typeEnv.  end(); }
+	// has to come after declaration of typeMap
+	auto begin()       -> decltype( typeMap.begin() ) { return typeMap.begin(); }
+	auto   end()       -> decltype( typeMap.  end() ) { return typeMap.  end(); }
+	auto begin() const -> decltype( typeMap.begin() ) { return typeMap.begin(); }
+	auto   end() const -> decltype( typeMap.  end() ) { return typeMap.  end(); }
 
 };
@@ -144,5 +145,5 @@
 			if ( const TypeExpr *actual = actualIt->template as<TypeExpr>() ) {
 				if ( formal->name != "" ) {
-					typeEnv[ formal ] = actual->type;
+					typeMap[ formal ] = actual->type;
 				} // if
 			} else {
Index: src/GenPoly/Specialize.cc
===================================================================
--- src/GenPoly/Specialize.cc	(revision 720f2fe263de46a16198a07023bfeb3b7cbe8876)
+++ src/GenPoly/Specialize.cc	(revision a8b87d3db4fd7828fac5029e592eb07f8b87bcb6)
@@ -247,4 +247,5 @@
 			structureArg( (*actualBegin)->get_type(), argBegin, argEnd, back_inserter( appExpr->get_args() ) );
 		}
+		assertf( argBegin == argEnd, "Did not structure all arguments." );
 
 		appExpr->env = TypeSubstitution::newFromExpr( appExpr, env );
