diff --git a/hw3/dsh b/hw3/dsh
index 34e87e91f6ac8bcbcb4531b93588307288026695..402ea6dd51b539bbfc7ea33e3abda1bb507bce45 100755
Binary files a/hw3/dsh and b/hw3/dsh differ
diff --git a/hw3/dsh.dSYM/Contents/Resources/DWARF/dsh b/hw3/dsh.dSYM/Contents/Resources/DWARF/dsh
index c278650260f6a7682cead370b059d53bc92dd3f2..8cf5611a3a6911cb3ca3ff3742e5056880100151 100644
Binary files a/hw3/dsh.dSYM/Contents/Resources/DWARF/dsh and b/hw3/dsh.dSYM/Contents/Resources/DWARF/dsh differ
diff --git a/hw3/dshlib.c b/hw3/dshlib.c
index d207cc8b64dc121b70375f8b466e4fd0e892ece9..b3c53232803868946d26767a6c6cfc48540d75c6 100644
--- a/hw3/dshlib.c
+++ b/hw3/dshlib.c
@@ -32,50 +32,56 @@
  *  Standard Library Functions You Might Want To Consider Using
  *      memset(), strcmp(), strcpy(), strtok(), strlen(), strchr()
  */
-int build_cmd_list(char *cmd_line, command_list_t *clist)
-{
-    char *pointer = cmd_line;
-    char* pipe = strchr(pointer, PIPE_CHAR);
-
-    clist->num = 0;
-
-    command_t new_command;
 
-    void make_command(command_t new_command, char *pointer, command_list_t *clist, size_t sub_length){
-        while (*pointer == ' '){
-            pointer++;
-        }
-        char *space = strchr(pointer, SPACE_CHAR);
+void make_command(command_t new_command, char *pointer, command_list_t *clist, size_t sub_length){
+    while (*pointer == ' '){
+        pointer++;
+    }
+    char *space = strchr(pointer, SPACE_CHAR);
 
-        if (space==NULL){
-            memset(new_command.exe, 0, sizeof(new_command.exe));
-            size_t exe_length = strlen(pointer);
-            strncpy(new_command.exe, pointer, exe_length);
+    if (space==NULL){
+        memset(new_command.exe, 0, sizeof(new_command.exe));
+        size_t exe_length = strlen(pointer);
+        strncpy(new_command.exe, pointer, exe_length);
 
-            memset(new_command.args, 0, sizeof(new_command.args));
-            new_command.args[0] = '\0';
+        memset(new_command.args, 0, sizeof(new_command.args));
+        new_command.args[0] = '\0';
 
+        if (clist->num < CMD_MAX){
             clist->commands[clist->num] = new_command;
-            clist->num = clist->num+1;
-        } else{
-            while (*space==' '){
-                space++;
-            }
-            size_t exe_length = space - pointer;
-            memset(new_command.exe, 0, sizeof(new_command.exe));
-            strncpy(new_command.exe, pointer, exe_length);
-            new_command.exe[exe_length] = '\0';
-            
-            size_t arg_length = pointer + sub_length - space;
-            memset(new_command.args, 0, sizeof(new_command.args));
-            strncpy(new_command.args, space, arg_length);
-            new_command.args[arg_length] = '\0';
+        
+        }
+        clist->num = clist->num+1;
+    } else{
+        while (*space==' '){
+            space++;
+        }
+        size_t exe_length = space - pointer;
+        memset(new_command.exe, 0, sizeof(new_command.exe));
+        strncpy(new_command.exe, pointer, exe_length);
+        new_command.exe[exe_length] = '\0';
+        
+        size_t arg_length = pointer + sub_length - space;
+        memset(new_command.args, 0, sizeof(new_command.args));
+        strncpy(new_command.args, space, arg_length);
+        new_command.args[arg_length] = '\0';
+        if (clist->num < CMD_MAX){
             clist->commands[clist->num] = new_command;
-            clist-> num = clist->num + 1;
+        
         }
+        clist->num = clist->num+1;
     }
+}
+
+int build_cmd_list(char *cmd_line, command_list_t *clist)
+{
+    char *pointer = cmd_line;
+    char* pipe = strchr(pointer, PIPE_CHAR);
+
+    clist->num = 0;
 
     while(pointer != NULL){
+        command_t new_command;
 
         pipe = strchr(pointer, PIPE_CHAR);