diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java b/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
index 8ccf50b..1f0c91d 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
@@ -58,7 +58,7 @@
         ncApplicationContext = ncAppCtx;
         nodeId = ncApplicationContext.getNodeId();
         if (LOGGER.isLoggable(Level.INFO)) {
-            LOGGER.info("Starting Asterix node controller  TAKE NOTE: " + nodeId);
+            LOGGER.info("Starting Asterix node controller: " + nodeId);
         }
 
         runtimeContext = new AsterixAppRuntimeContext(ncApplicationContext);
@@ -118,7 +118,6 @@
 
     @Override
     public void notifyStartupComplete() throws Exception {
-        IAsterixStateProxy proxy = (IAsterixStateProxy) ncApplicationContext.getDistributedState();
         AsterixMetadataProperties metadataProperties = ((IAsterixPropertiesProvider) runtimeContext)
                 .getMetadataProperties();
 
@@ -135,6 +134,7 @@
             localResourceRepository.initialize(nodeId, metadataProperties.getStores().get(nodeId)[0], true, null);
         }
 
+        IAsterixStateProxy proxy = null;
         isMetadataNode = nodeId.equals(metadataProperties.getMetadataNodeName());
         if (isMetadataNode) {
             if (LOGGER.isLoggable(Level.INFO)) {
@@ -142,6 +142,11 @@
             }
             MetadataNode.INSTANCE.initialize(runtimeContext);
 
+            proxy = (IAsterixStateProxy) ncApplicationContext.getDistributedState();
+            if (proxy == null) {
+                throw new IllegalStateException("Metadata node cannot access distributed state");
+            }
+
             // This is a special case, we just give the metadataNode directly.
             // This way we can delay the registration of the metadataNode until
             // it is completely initialized.
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/AsterixClusterProperties.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/AsterixClusterProperties.java
index 9362844..8e393d7 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/AsterixClusterProperties.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/AsterixClusterProperties.java
@@ -3,9 +3,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * you may obtain a copy of the License from
- * 
+ *
  *     http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,10 +17,10 @@
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.HashSet;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -97,34 +97,27 @@
 
     /**
      * Returns the number of IO devices configured for a Node Controller
-     * 
+     *
      * @param nodeId
      *            unique identifier of the Node Controller
      * @return number of IO devices. -1 if the node id is not valid. A node id
      *         is not valid if it does not correspond to the set of registered
      *         Node Controllers.
      */
-    public synchronized int getNumberOfIODevices(String nodeId) {
-        Map<String, String> ncConfig = ncConfiguration.get(nodeId);
-        if (ncConfig == null) {
-            if (LOGGER.isLoggable(Level.WARNING)) {
-                LOGGER.warning("Configuration parameters for nodeId " + nodeId
-                        + " not found. The node has not joined yet or has left.");
-            }
-            return -1;
-        }
-        return ncConfig.get(IO_DEVICES).split(",").length;
+    public int getNumberOfIODevices(String nodeId) {
+        String[] ioDevs = getIODevices(nodeId);
+        return ioDevs == null ? -1 : ioDevs.length;
     }
 
     /**
      * Returns the IO devices configured for a Node Controller
-     * 
+     *
      * @param nodeId
      *            unique identifier of the Node Controller
      * @return a list of IO devices. null if node id is not valid. A node id is not valid
      *         if it does not correspond to the set of registered Node Controllers.
      */
-    public String[] getIODevices(String nodeId) {
+    public synchronized String[] getIODevices(String nodeId) {
         Map<String, String> ncConfig = ncConfiguration.get(nodeId);
         if (ncConfig == null) {
             if (LOGGER.isLoggable(Level.WARNING)) {
@@ -181,67 +174,6 @@
         clusterPartitionConstraint = new AlgebricksAbsolutePartitionConstraint(cluster);
     }
 
-    private static class AsterixCluster {
-
-        private final String asterixInstance;
-        private Map<String, AsterixNode> asterixNodes;
-
-        public AsterixCluster(Cluster cluster) {
-            asterixInstance = cluster.getInstanceName();
-            asterixNodes = new HashMap<String, AsterixNode>();
-            for (Node node : cluster.getNode()) {
-                AsterixNode aNode = new AsterixNode(node, AsterixNode.NodeRole.PARTICIPANT,
-                        AsterixNode.NodeState.INACTIVE);
-                asterixNodes.put(asterixInstance + "_" + node.getId(), aNode);
-            }
-
-            for (Node node : cluster.getSubstituteNodes().getNode()) {
-                AsterixNode aNode = new AsterixNode(node, AsterixNode.NodeRole.SUBSTITUTE,
-                        AsterixNode.NodeState.INACTIVE);
-                asterixNodes.put(asterixInstance + "_" + node.getId(), aNode);
-            }
-        }
-
-        private static class AsterixNode {
-
-            private final Node node;
-            private NodeRole role;
-            private NodeState state;
-
-            public enum NodeRole {
-                PARTICIPANT,
-                SUBSTITUTE
-            }
-
-            public enum NodeState {
-                ACTIVE,
-                INACTIVE
-            }
-
-            public AsterixNode(Node node, NodeRole role, NodeState state) {
-                this.node = node;
-                this.role = role;
-                this.state = state;
-            }
-
-            @Override
-            public String toString() {
-                return node.getId() + "_" + role + "_" + state;
-            }
-        }
-
-        public void notifyChangeState(String nodeId, AsterixNode.NodeRole newRole, AsterixNode.NodeState newState) {
-            AsterixNode node = asterixNodes.get(nodeId);
-            if (node != null) {
-                node.role = newRole;
-                node.state = newState;
-            } else {
-                throw new IllegalStateException("Unknown nodeId" + nodeId);
-            }
-
-        }
-    }
-
     public boolean isGlobalRecoveryCompleted() {
         return globalRecoveryCompleted;
     }
