                 // Dialing should come last..
                 // TODO:  Need to allow for spaces after D, DT, DP.  Currently fails.
                 case 'D':
-                switch(Modem_CommandBuffer[i])
+                switch(Modem_CommandBuffer[i++])
                 {
                     case 'T':
                     case 'P':
-                    removeSpaces(&Modem_CommandBuffer[i+1]);
-                    Modem_Dialout(&Modem_CommandBuffer[i+1]);
-                    suppressOkError = 1;
-                    i = COMMAND_BUFFER_SIZE-3;    // Make sure we don't try to process any more...
+
+                    switch(Modem_CommandBuffer[i++])
+                    {
+                        case '#':
+                        // Phonebook dial
+                        numString[0] = Modem_CommandBuffer[i];
+                        numString[1] = '\0';
+            
+                        phoneBookNumber = atoi(numString);
+                        if (phoneBookNumber >= 1 && phoneBookNumber <= ADDR_HOST_ENTRIES)
+                        {
+                            strncpy(address,readEEPROMPhoneBook(ADDR_HOSTS + ((phoneBookNumber-1) * ADDR_HOST_SIZE)).c_str(),ADDR_HOST_SIZE);
+                            removeSpaces(address);
+                            Modem_Dialout(address);
+                            suppressOkError = 1;                        
+                        }
+                        else
+                            errors++;
+                        break;                     
+
+                        default:
+                        i--;
+                        removeSpaces(&Modem_CommandBuffer[i]);
+                        Modem_Dialout(&Modem_CommandBuffer[i]);
+                        suppressOkError = 1;
+                        i = COMMAND_BUFFER_SIZE-3;    // Make sure we don't try to process any more...
+                        break;
+                    }
                     break;
-
+                    
                     case '#':
                     // Phonebook dial
-                    //char numString[2];
-                    numString[0] = Modem_CommandBuffer[i+1];
+                    numString[0] = Modem_CommandBuffer[i];
                     numString[1] = '\0';
-                    //char address[ADDR_HOST_SIZE];
         
-                    //int phoneBookNumber = atoi(numString);
                     phoneBookNumber = atoi(numString);
                     if (phoneBookNumber >= 1 && phoneBookNumber <= ADDR_HOST_ENTRIES)
                     {


;  // Keep this here to pacify the Arduino pre-processor

#define VERSION "0.07b4"

// Configuration 0v3: Wifi Hardware, C64 Software.


                    break;

                    default:
                    i--;        // ATD
                    removeSpaces(&Modem_CommandBuffer[i]);
                    Modem_Dialout(&Modem_CommandBuffer[i]);
                    suppressOkError = 1;
