Index: /trunk/gli/src/org/greenstone/gatherer/cdm/CollectionConfiguration.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/cdm/CollectionConfiguration.java	(revision 5929)
+++ /trunk/gli/src/org/greenstone/gatherer/cdm/CollectionConfiguration.java	(revision 5930)
@@ -737,65 +737,60 @@
 	boolean special = false;
 	// If there is no value attribute, then we don't write anything
+	StringBuffer text = new StringBuffer("");
+	String name_str = command_element.getAttribute(NAME_ATTRIBUTE);
+	// If the name is one of the special four, we don't write the collectionmeta first. Note the maintainer collectionmeta is singled out for 'prittying' reasons.
+	if(name_str.equals(COLLECTIONMETADATA_MAINTAINER_STR)) {
+	    text.append(name_str);
+	    text.append(TAB_CHARACTER);
+	    special = true;
+	}
+	else if(name_str.equals(COLLECTIONMETADATA_BETA_STR) || name_str.equals(COLLECTIONMETADATA_CREATOR_STR) || name_str.equals(COLLECTIONMETADATA_PUBLIC_STR)) {
+	    text.append(name_str);
+	    text.append(TAB_CHARACTER);
+	    text.append(TAB_CHARACTER);
+	    special = true;
+	}
+	else {
+	    text.append(COLLECTIONMETADATA_STR);
+	    text.append(TAB_CHARACTER);
+	    text.append(name_str);
+	    text.append(SPACE_CHARACTER);
+	    String language_str = command_element.getAttribute(LANGUAGE_ATTRIBUTE);
+	    // If this is element is in english, and it is the first one found, we don't need to write the language argument.
+	    //if(!language_str.equals(ENGLISH_LANGUAGE_STR) || known_metadata == null || known_metadata.contains(name_str)) {
+	    // changed so that we always write the language string
+	    text.append(LBRACKET_CHARACTER);
+	    text.append(LANGUAGE_ARGUMENT);
+	    text.append(language_str);
+	    text.append(RBRACKET_CHARACTER);
+	    text.append(SPACE_CHARACTER);
+	    //}
+	    if(known_metadata != null) {
+		known_metadata.add(name_str);
+	    }
+	    language_str = null;
+	}
+	name_str = null;
+	
 	String value_str = MSMUtils.getValue(command_element);
-	if(value_str == null || value_str.length() == 0) {
-	    return "";
+	// The value string we retrieved will be encoded for xml, so we now decode it - to text if text_value set. This parameter was originally show_extracted_namespace, but sincethis is only true for 'toString()' commands from within the CDM, its good enough to determine if this toString() will be used to display on screen, or write to collect.cfg
+	if(text_value == CollectionMeta.TEXT) {
+	    value_str = Codec.transform(value_str, Codec.DOM_TO_TEXT);
 	}
 	else {
-	    StringBuffer text = new StringBuffer("");
-	    String name_str = command_element.getAttribute(NAME_ATTRIBUTE);
-	    // If the name is one of the special four, we don't write the collectionmeta first. Note the maintainer collectionmeta is singled out for 'prittying' reasons.
-	    if(name_str.equals(COLLECTIONMETADATA_MAINTAINER_STR)) {
-		text.append(name_str);
-		text.append(TAB_CHARACTER);
-		special = true;
-	    }
-	    else if(name_str.equals(COLLECTIONMETADATA_BETA_STR) || name_str.equals(COLLECTIONMETADATA_CREATOR_STR) || name_str.equals(COLLECTIONMETADATA_PUBLIC_STR)) {
-		text.append(name_str);
-		text.append(TAB_CHARACTER);
-		text.append(TAB_CHARACTER);
-		special = true;
-	    }
-	    else {
-		text.append(COLLECTIONMETADATA_STR);
-		text.append(TAB_CHARACTER);
-		text.append(name_str);
-		text.append(SPACE_CHARACTER);
-		String language_str = command_element.getAttribute(LANGUAGE_ATTRIBUTE);
-		// If this is element is in english, and it is the first one found, we don't need to write the language argument.
-		//if(!language_str.equals(ENGLISH_LANGUAGE_STR) || known_metadata == null || known_metadata.contains(name_str)) {
-		// changed so that we always write the language string
-		text.append(LBRACKET_CHARACTER);
-		text.append(LANGUAGE_ARGUMENT);
-		text.append(language_str);
-		text.append(RBRACKET_CHARACTER);
-		text.append(SPACE_CHARACTER);
-		//}
-		if(known_metadata != null) {
-		    known_metadata.add(name_str);
-		}
-		language_str = null;
-	    }
-	    name_str = null;
-
-	    // The value string we retrieved will be encoded for xml, so we now decode it - to text if text_value set. This parameter was originally show_extracted_namespace, but sincethis is only true for 'toString()' commands from within the CDM, its good enough to determine if this toString() will be used to display on screen, or write to collect.cfg
-	    if(text_value == CollectionMeta.TEXT) {
-		value_str = Codec.transform(value_str, Codec.DOM_TO_TEXT);
-	    }
-	    else {
-        	value_str = Codec.transform(value_str, Codec.DOM_TO_GREENSTONE);
-	    }
-
-	    // We don't wrap the email addresses in quotes, nor any string without spaces
-	    if(special) {
-		text.append(value_str);
-	    }
-	    else {
-		text.append(SPEECH_CHARACTER);
-		text.append(value_str);
-		text.append(SPEECH_CHARACTER);
-	    }
-	    value_str = null;
-	    return text.toString();
-	}
+	    value_str = Codec.transform(value_str, Codec.DOM_TO_GREENSTONE);
+	}
+	
+	// We don't wrap the email addresses in quotes, nor the other special metadata
+	if(special) {
+	    text.append(value_str);
+	}
+	else {
+	    text.append(SPEECH_CHARACTER);
+	    text.append(value_str);
+	    text.append(SPEECH_CHARACTER);
+	}
+	value_str = null;
+	return text.toString();
     }
 
@@ -1254,4 +1249,5 @@
 		    command_element.setAttribute(NAME_ATTRIBUTE, name_str);
 		    command_element.setAttribute(LANGUAGE_ATTRIBUTE, language_str);
+		    command_element.setAttribute(ASSIGNED_ATTRIBUTE, TRUE_STR);
 		    MSMUtils.setValue(command_element, value_str);
 		}
@@ -1293,4 +1289,5 @@
 		    command_element.setAttribute(LANGUAGE_ATTRIBUTE, ENGLISH_LANGUAGE_STR);
 		    command_element.setAttribute(SPECIAL_ATTRIBUTE, TRUE_STR);
+		    command_element.setAttribute(ASSIGNED_ATTRIBUTE, TRUE_STR);
 		    if(value_str.startsWith(SPEECH_CHARACTER) && value_str.endsWith(SPEECH_CHARACTER)) {
 			value_str = value_str.substring(1, value_str.length() - 1);
Index: /trunk/gli/src/org/greenstone/gatherer/cdm/CollectionMeta.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/cdm/CollectionMeta.java	(revision 5929)
+++ /trunk/gli/src/org/greenstone/gatherer/cdm/CollectionMeta.java	(revision 5930)
@@ -53,6 +53,6 @@
 
     private boolean dummy = false;
-    private Element element;
-    private String text;
+    private Element element = null;
+    private String text = null;
 
     /** Constructor.
@@ -68,4 +68,5 @@
 	element.setAttribute(StaticStrings.NAME_ATTRIBUTE, name);
 	element.setAttribute(StaticStrings.LANGUAGE_ATTRIBUTE, Gatherer.config.interface_language);
+	element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.FALSE_STR);
     }
 
@@ -75,4 +76,5 @@
 	element.setAttribute(StaticStrings.NAME_ATTRIBUTE, name);
 	element.setAttribute(StaticStrings.LANGUAGE_ATTRIBUTE, language);
+	element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.FALSE_STR);
     }
 
@@ -170,4 +172,6 @@
 	MSMUtils.setValue(element, Codec.transform(raw_value, Codec.TEXT_TO_DOM));
 	text = null; // Reset text
+	// And determine if this makes the metadata assigned
+	setAssigned(raw_value != null && raw_value.length() > 0);
     }
 
Index: /trunk/gli/src/org/greenstone/gatherer/cdm/CollectionMetaManager.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/cdm/CollectionMetaManager.java	(revision 5929)
+++ /trunk/gli/src/org/greenstone/gatherer/cdm/CollectionMetaManager.java	(revision 5930)
@@ -61,5 +61,4 @@
 	    // Locate where we should insert this new subcollection. 
 	    Node target_node = CollectionConfiguration.findInsertionPoint(element);
-	    // Failing that we insert immediately after a language string
 	    add(root, metadata, target_node);
 	    Gatherer.c_man.configurationChanged();
@@ -126,5 +125,5 @@
 	    CollectionMeta metadatum = (CollectionMeta) getElementAt(i);
 	    if(metadatum.getName().equals(name) && metadatum.getLanguage().equals(Gatherer.config.interface_language)) {
-		//Gatherer.println("Found '" + metadatum + "'");
+		Gatherer.println("Found '" + metadatum + "'");
 		return metadatum;
 	    }
@@ -137,5 +136,5 @@
 	    CollectionMeta result = new CollectionMeta(name);
 	    addMetadatum(result);
-	    //Gatherer.println("Added new metadata.");
+	    Gatherer.println("Added new metadata: " + name);
 	    return result;
 	}
