Index: /vtcross/trunk/src/shell/CognitiveRadioShell.cpp
===================================================================
--- /vtcross/trunk/src/shell/CognitiveRadioShell.cpp	(revision 435)
+++ /vtcross/trunk/src/shell/CognitiveRadioShell.cpp	(revision 437)
@@ -66,5 +66,5 @@
     delete [] observables;
     delete [] utils;
-    delete Radio_Info;
+    delete radio_info;
 }
 
@@ -219,5 +219,5 @@
 CognitiveRadioShell::RegisterCognitiveEngine(int32_t socketFD)
 {
-    LOG("Cognitive Radio Shell:: Received registration from Cognitive Engine on socket %d.\n" \
+    LOG("Cognitive Radio Shell:: Received registration from Cognitive Engine on socket %d.\n", \
             socketFD);
    
@@ -304,17 +304,17 @@
     LOG("Cognitive Radio Shell:: Received Set Active Mission command from host.\n");
    
-    // Read the name of the active mission to be set from the host. 
+    /* Read the name of the active mission to be set from the host. */
     memset(buffer, 0, 256);
     ReadMessage(commandSocketFD, buffer);
 
-    // Send command to SML
+    /* Send command to SML. */
     SendMessage(ceSocketFD, "set_active_mission");
     SendMessage(ceSocketFD, buffer);
 
-    // Get ack from SML saying the mission was set properly
+    /* Get ack from SML saying the mission was set properly */
     memset(buffer, 0, 256);
     ReadMessage(ceSocketFD, buffer);
 
-    // Forward ack to host
+    /* Forward ack to host */
     SendMessage(commandSocketFD, buffer);
 }
@@ -342,5 +342,5 @@
     bool loadOkay = doc.LoadFile();
     if(!loadOkay)
-        ERROR(1,"Loading radio configuration failed: %s\n", radioConfig);
+        ERROR(1, "Loading radio configuration failed: %s\n", radioConfig);
 
     TiXmlHandle hDoc(&doc);
@@ -488,4 +488,5 @@
     LOG("Cognitive Radio Shell:: Parsed %d parameters.\n", radioInfo->numParameters);
 
+    /* TODO always returning one seems useless? */
     return 1;
 }
@@ -524,5 +525,5 @@
   
     LOG("Cognitive Radio Shell:: Attempting to get %i parameters.\n",numCurrentParameters);
-    Parameter * cp = new Parameter[numCurrentParameters];
+    Parameter *cp = new Parameter[numCurrentParameters];
 
     for (size_t i = 0; i < numCurrentParameters; i++){
@@ -530,4 +531,5 @@
         ReadMessage(commandSocketFD,buffer);
         cp[i].name = std::string(buffer);
+
         memset(buffer, 0, 256);
         ReadMessage(commandSocketFD,buffer);
@@ -558,6 +560,6 @@
     }
 
+    /* Receive Set of Parameters */
     LOG("Cognitive Radio Shell:: Receiving optimized parameters.\n");
-    /* Receive Set of Parameters */
     memset(buffer, 0, 256);
     ReadMessage(ceSocketFD, buffer);
@@ -611,4 +613,5 @@
         ReadMessage(commandSocketFD,buffer);
         p[i].name = std::string(buffer);
+
         memset(buffer, 0, 256);
         ReadMessage(commandSocketFD,buffer);
@@ -658,5 +661,5 @@
     delete [] o;
     
-    return 1;
+    return true;
 }
 
@@ -669,9 +672,8 @@
     
     ret = ReadMessage(socketFD, buffer);
-    if(ret == -1) {
-	return ret;
-    }
-
-    // TODO trying to read this code lock makes my eyes bleed
+    if(ret == -1)
+        return ret;
+
+    // TODO trying to read this code block makes my eyes bleed
     if(strcmp(buffer, "register_engine_cognitive") == 0) { 
         RegisterCognitiveEngine(socketFD);
@@ -728,6 +730,4 @@
     fd_set sockSet;
    
-
-
     int32_t *servSock = new int32_t[3];
 
@@ -757,5 +757,5 @@
     FD_ZERO(&sockSet);
     
-    while (running) {
+    while(running) {
         /* Zero socket descriptor vector and set for server sockets */
         /* This must be reset every time select() is called */
@@ -780,11 +780,11 @@
                     desc_ready -= 1;
                     /* Check if request is new or on an existing open descriptor */
-                    if((port == servSock[primary]) || (port == servSock[policy]) || (port == servSock[command])) { 
+                    if((port == servSock[primary]) || \
+                            (port == servSock[policy]) || \
+                            (port == servSock[command])) { 
                         do {
                             new_sd = AcceptTCPConnection(port);
-                            if(new_sd < 0) {
+                            if(new_sd < 0)
                                 break;
-			    }
-                           
                             if(port == servSock[primary])
                                 ceSocketFD = new_sd;
@@ -796,21 +796,22 @@
                             ret = HandleMessage(new_sd);
 
-			    if(ret == -1) {
-				FD_CLR(new_sd,&sockSet);
-				close(new_sd);
-				break;
-			    }
-
-			    FD_SET(new_sd,&sockSet);
+                            if(ret == -1) {
+                                FD_CLR(new_sd,&sockSet);
+                                close(new_sd);
+                                break;
+                            }
+
+                            FD_SET(new_sd,&sockSet);
                             if(new_sd > maxDescriptor) 
                                 maxDescriptor = new_sd;
+
                         } while(new_sd != -1);
-		    } 
+                    } 
                     else {
                         ret = HandleMessage(port);
-			if(ret == -1) {
-			    FD_CLR(port,&sockSet);
-			    close(port);
-			}
+                        if(ret == -1) {
+                            FD_CLR(port,&sockSet);
+                            close(port);
+                        }
                     }
                 }
@@ -820,4 +821,5 @@
 
     LOG("Closing it all.\n\n");
+
     /* Close sockets */
     close(servSock[primary]);
