Index: /trunk/psModules/src/detrend/pmDetrendDB.c
===================================================================
--- /trunk/psModules/src/detrend/pmDetrendDB.c	(revision 37836)
+++ /trunk/psModules/src/detrend/pmDetrendDB.c	(revision 37837)
@@ -356,4 +356,34 @@
     psTrace("psModules.detrend", 5, "detrend file: %s\n", result);
 
+    char *is_nebulous = strstr(result,"neb://");
+    if (is_nebulous) { // This file matches the nebulous string
+      psString truncated = psStringCopy(is_nebulous + 6);
+      //      printf("A: %s %s\n",result,truncated);
+      psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes,"PPIMAGE");
+      psMetadata *detloc = psMetadataLookupMetadata(NULL, recipe, "DETREND.LOCATIONS");
+      if (detloc) { // This exists, so we have the information.
+	psString location = psMetadataLookupStr(NULL, detloc,classID);
+	//	printf("B: %s %s\n", classID,location);
+	if (location) { // Found a location
+	  psString ext_key = strstr(truncated,"/"); // Find the first '/'
+	  //	  printf("C: %s\n", ext_key);
+	  if (ext_key) {
+	    psString copyBecauseReasons = psStringCopy(ext_key);
+	    psStringPrepend(&copyBecauseReasons,"neb://%s",location);
+	    //	    printf("D: %s\n",copyBecauseReasons);
+	    psFree(result); // Yes, because we are going to reallocate a clean copy of cBR to this object.
+	    result = psStringCopy(copyBecauseReasons);
+	    //	    psFree(ext_key); // No, because this is just a pointer into some other memory space.
+	    psTrace("psModules.detrend", 5, "altered detrend file: %s\n", result);
+	    psFree(copyBecauseReasons); // Yes, because we copied this to the output object, and so we don't need this any more.
+	  }
+	  //	  psFree(location);  // Don't free this because the string lookup isn't a copy, so it deletes it from the config structure entirely.
+	}
+      }
+      //      psFree(is_nebulous);  // No, because this is just a pointer into some other memory space.
+      psFree(truncated);
+    }
+	  
+    
     psFree (answer);
     psFree (pipe);
