Index: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/build/GS2PerlConstructor.java
===================================================================
--- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/build/GS2PerlConstructor.java	(revision 30616)
+++ main/trunk/greenstone3/src/java/org/greenstone/gsdl3/build/GS2PerlConstructor.java	(revision 30617)
@@ -35,5 +35,5 @@
 	public static final int BUILD = 2;
 	public static final int ACTIVATE = 3;
-    public static final int SET_METADATA_SERVER = 4;
+    public static final int MODIFY_METADATA_SERVER = 4;
 
 	/**
@@ -122,6 +122,6 @@
 			activateCollection();
 			break;
-		case SET_METADATA_SERVER:
-			setMetadataForCollection();
+		case MODIFY_METADATA_SERVER:
+			modifyMetadataForCollection();
 			break;
 		default:
@@ -285,5 +285,5 @@
 		command.add("-collectdir");
 		command.add(GSFile.collectDir(this.site_home));
-//		command.add("-removeold"); // saves some seconds processing time when this flag's added in explicitly
+//		command.add("-removeold"); // saves some seconds processing time when this flag's added in explicitly. Shouldn't be added for incremental building
 		command.add("-skipactivation"); // gsdl3/util/GS2Construct does the activation and reactivation
 		command.addAll(extractParameters(this.process_params));
@@ -302,7 +302,7 @@
 
 
-    protected void setMetadataForCollection()
-	{
-		sendMessage(new ConstructionEvent(this, GSStatus.INFO, "Collection metadata: setMetadata for collection."));
+    protected void modifyMetadataForCollection()
+	{
+		sendMessage(new ConstructionEvent(this, GSStatus.INFO, "Collection metadata: modifyMetadata (set or remove meta) for collection."));
 
 		Vector<String> command = new Vector<String>();
Index: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/DocumentMaker.java
===================================================================
--- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/DocumentMaker.java	(revision 30616)
+++ main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/DocumentMaker.java	(revision 30617)
@@ -487,5 +487,6 @@
 		if (!coll_db.openDatabase(coll_db_file, SimpleCollectionDatabase.READ))
 		{
-			logger.error("Could not open collection archives database. Somebody already using this database!");
+			logger.error("Could not open collection archives database. Database doesn't exist or else somebody's already using it?");
+			return;
 		}
 		String old_value = coll_db.getValue(oid);
@@ -496,4 +497,5 @@
 		{
 			logger.error("Could not open collection archives database. Somebody already using this database!");
+			return;
 		}
 		coll_db.setValue(oid, new_value);
Index: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2Construct.java
===================================================================
--- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2Construct.java	(revision 30616)
+++ main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2Construct.java	(revision 30617)
@@ -67,5 +67,6 @@
 	private static final String DELETE_SERVICE = "DeleteCollection";
 	private static final String RELOAD_SERVICE = "ReloadCollection";
-    private static final String SET_METADATA_SERVICE = "SetMetadata";
+	private static final String MODIFY_METADATA_SERVICE = "ModifyMetadata"; // set or remove metadata
+
 
 	// params used
@@ -128,5 +129,5 @@
 				param_list.appendChild(param);
 			}
-			else if (service.equals(ACTIVATE_SERVICE) || service.equals(IMPORT_SERVICE) || service.equals(BUILD_SERVICE) || service.equals(RELOAD_SERVICE) || service.equals(DELETE_SERVICE) || service.equals(SET_METADATA_SERVICE))
+			else if (service.equals(ACTIVATE_SERVICE) || service.equals(IMPORT_SERVICE) || service.equals(BUILD_SERVICE) || service.equals(RELOAD_SERVICE) || service.equals(DELETE_SERVICE) || service.equals(MODIFY_METADATA_SERVICE))
 			{
 
@@ -185,11 +186,12 @@
 	{
 	    // check permissions
-		if (!userHasCollectionEditPermissions(request)) {
+	    if (!userHasCollectionEditPermissions(request)) {
 		    Document result_doc = XMLConverter.newDOM();
 		    Element result = GSXML.createBasicResponse(result_doc, "processBuildAndActivateCollection");
 		    GSXML.addError(result, "This user does not have the required permissions to perform this action.");
 		    return result;
-		}
-
+	    }
+
+		    
 		waitUntilReady(request);
 		Element buildResponse = processBuildCollection(request);
@@ -305,14 +307,14 @@
 	}
 
-    protected Element processSetMetadata(Element request)
+	protected Element processModifyMetadata(Element request)
 	{
 	    if (!userHasCollectionEditPermissions(request)) {
 		Document result_doc = XMLConverter.newDOM();
-		Element result = GSXML.createBasicResponse(result_doc, "processSetMetadata");
+		Element result = GSXML.createBasicResponse(result_doc, "processModifyMetadata");
 		GSXML.addError(result, "This user does not have the required permissions to perform this action.");
 		return result;
 	    }
 
-	    return runCommand(request, GS2PerlConstructor.SET_METADATA_SERVER);
+	    return runCommand(request, GS2PerlConstructor.MODIFY_METADATA_SERVER);
 	}
 
@@ -619,5 +621,5 @@
 		e = this.desc_doc.createElement(GSXML.SERVICE_ELEM);
 		e.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_PROCESS);
-		e.setAttribute(GSXML.NAME_ATT, SET_METADATA_SERVICE);
+		e.setAttribute(GSXML.NAME_ATT, MODIFY_METADATA_SERVICE);
 		this.short_service_info.appendChild(e);
 
@@ -708,5 +710,5 @@
 			constructor.setManifestFile(this.site_home + File.separator + "collect" + File.separator + params.get(COL_PARAM) + File.separator + "manifests" + File.separator + "tempManifest.xml");
 		}
-		else if (type == GS2PerlConstructor.SET_METADATA_SERVER) {
+		else if (type == GS2PerlConstructor.MODIFY_METADATA_SERVER) {
 		    StringBuffer querystring = new StringBuffer();
 		    
@@ -977,5 +979,5 @@
 		if (!coll_db.openDatabase(coll_db_file, SimpleCollectionDatabase.READ))
 		{
-			logger.error("Could not open collection archives database. Database doesn't exist or else somebody is already using it?");
+			logger.error("Could not open collection archives database. Database doesn't exist or else somebody's already using it?");
 			return;
 		}
@@ -988,4 +990,5 @@
 		{
 			logger.error("Could not open collection archives database. Somebody already using this database!");
+			return;
 		}
 		coll_db.setValue(oid, new_value);
Index: main/trunk/greenstone3/web/interfaces/default/js/javascript-global-functions.js
===================================================================
--- main/trunk/greenstone3/web/interfaces/default/js/javascript-global-functions.js	(revision 30616)
+++ main/trunk/greenstone3/web/interfaces/default/js/javascript-global-functions.js	(revision 30617)
@@ -424,20 +424,20 @@
 function callMetadataServer(callingFunction, url, responseFunction)
 {
-    // rewrite URLs to call GS2Construct's SetMetadata service instead. 
+    // If doing set- or remove- (not get-) metadata, then rewrite URLs to call GS2Construct's ModfiyMetadata service instead (which will ensure this only works when authenticated). 
     // From:
     // <gs3server>/cgi-bin/metadata-server.pl?a=set-archives-metadata&c=smallcol&site=localsite&d=HASH01454f31011f6b6b26eaf8d7&metaname=Title&metavalue=Moo&prevmetavalue=Blabla&metamode=override
     // To:
-    // <gs3server>/library?a=g&rt=r&ro=1&s=SetMetadata&s1.a=set-archives-metadata&s1.collection=smallcol&s1.site=localsite&s1.d=HASH01454f31011f6b6b26eaf8d7&s1.metaname=Title&s1.metavalue=Moo&s1.prevmetavalue=Blabla&s1.metamode=override
-
-    // if we're doing a set- metdata operation, then we'll be changing the URL to make sure we go through GS3's authentication
-    if(url.indexOf("set-") != -1) {
+    // <gs3server>/library?a=g&rt=r&ro=1&s=ModifyMetadata&s1.a=set-archives-metadata&s1.collection=smallcol&s1.site=localsite&s1.d=HASH01454f31011f6b6b26eaf8d7&s1.metaname=Title&s1.metavalue=Moo&s1.prevmetavalue=Blabla&s1.metamode=override
+
+    // if we're doing a set- or remove- metadata operations, then we'll be changing the URL to make sure we go through GS3's authentication
+    if(url.indexOf("set-") != -1 || url.indexOf("remove-") != -1) {
+	
 	url = url.replace("&c=",  "&collection="); // c is a special param name for GS2Construct
 	url = url.replace(/(&|\?)([^=]*=)/g, "$1"+"s1.$2"); // prefix param names with "s1."
-	url = url.replace("cgi-bin/metadata-server.pl?",  gs.xsltParams.library_name + "?a=g&rt=r&ro=1&s=SetMetadata&");
-
+	url = url.replace("cgi-bin/metadata-server.pl?",  gs.xsltParams.library_name + "?a=g&rt=r&ro=1&s=ModifyMetadata&");
 	console.log("@@@@@ URL is " + url);
     } // otherwise, such as for get- metadata operation, we proceed as before, which will not require authentication
-
-	$.ajax(url)
+    
+    $.ajax(url, {async: false})
 	.success(function(response)
 	{
