// Look through the array of instances, and see if we need to add/remove any - configure the rest
NSMutableArray currentInstances = new NSMutableArray(aConfig.instanceArray());
if (instanceArray != null) {
for (Enumeration e = instanceArray.objectEnumerator(); e.hasMoreElements(); ) {
NSDictionary anInst = (NSDictionary) e.nextElement();
String hostName = (String) anInst.valueForKey("hostName");
Integer port = (Integer) anInst.valueForKey("port");
MInstance anMInstance = aConfig.instanceWithHostnameAndPort(hostName, port);
// if I can't find the instance, I might be updating the port - in that case, look under the oldport number.
if (anMInstance == null) {
port = (Integer) anInst.valueForKey("oldport");