 			return fn error if error?
 			fn null, contexts.add id, context
 		
-	navigate = ({shrub, window}, path, body, fn) ->
-		
+	navigate = (context, path, body, fn) ->
+		
+		{shrub, window} = context
 		{$location, $rootScope, forms} = shrub
+		
+		originalUrl = $location.url()
 		
 		# Process any forms.
 		formFn = ->

				navigate context, path, body, (delay) ->
					
					process.nextTick ->
						
						# Reload the session, server-side JS socket stuff could
						# have changed it!
						req.session.reload ->
							
							# Don't forget the doctype!
							res.end """
<!doctype html>
#{window.document.innerHTML}
"""
							
							deferred.resolve()
							context.promise = null

				# Touch the context to keep it alive.
				context.touch()
				
				# Emit the last HTML generated before the redirect.
				if context.redirect
					return process.nextTick ->
						res.end context.redirect
						context.redirect = null
				
				# Prevent a possible race condition that would hang up the
				# context in between now and render.
				deferred = Q.defer()
