diff --git a/.DS_Store b/.DS_Store
index b1d5ffd05b4a2a5df0a3d7e7f0ab95a9d60d40d1..0245558c0c237208c2d87412fec9d07c48f321b4 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/Hw2/stringfun b/Hw2/stringfun
index 8cb7308c3a354760af3f736e12c9caff340d3342..d8b2d0a6f3197872c0fa25d0066cd173225cfd6a 100755
Binary files a/Hw2/stringfun and b/Hw2/stringfun differ
diff --git a/Hw2/stringfun.c b/Hw2/stringfun.c
index 6b962f14954e141daf70cd6d5ed24682c20b91ea..43b3c80cd9f456c84e867345adb3f6e77b87aa62 100644
--- a/Hw2/stringfun.c
+++ b/Hw2/stringfun.c
@@ -21,7 +21,7 @@ int setup_buff(char *buff, char *user_str, int len){
     bool isSpace = false;
     int count = 0;
 
-    while (*user_str != '\0' && count < BUFFER_SZ - 1) { // stop when reaching the end-of-buffer
+    while (*user_str != '\0' && count < BUFFER_SZ) { // stop when reaching the end-of-buffer
         if (*user_str != '\t'){
             if (*user_str != ' ' || isSpace == false) {
                 *buff = *user_str;
@@ -42,7 +42,7 @@ int setup_buff(char *buff, char *user_str, int len){
         }
     }
     int ret = count;
-    if (count > len){
+    if (count >= BUFFER_SZ){
         return -1;
     }
     while (count <= len){
@@ -51,7 +51,7 @@ int setup_buff(char *buff, char *user_str, int len){
         count++;
     }
 
-    return ret; //for now just so the code compiles. 
+    return ret;
 }
 
 void print_buff(char *buff, int len){
@@ -76,6 +76,11 @@ int count_words(char *buff, int len, int str_len){
     if (str_len==0){
         return 0;
     }
+
+    if (str_len < 0){
+        return -1;
+    }
+    
     int words = 1;
     for (int i=0; i<str_len; i++){
         if (*buff == ' '){
@@ -137,7 +142,6 @@ void word_print(char *buff, int len, int str_len){
     printf(" (%d)\n",track);
 }
 
-// void replace(char *buff, *new_buff)
 
 int main(int argc, char *argv[]){
 
@@ -191,7 +195,7 @@ int main(int argc, char *argv[]){
     buff= (char*)malloc(BUFFER_SZ);
     user_str_len = setup_buff(buff, input_string, BUFFER_SZ);     //see todos
     if (user_str_len < 0){
-        printf("Error setting up buffer, error = %d", user_str_len);
+        printf("Error setting up buffer, error = %d\n", user_str_len);
         exit(2);
     }
 
@@ -219,11 +223,9 @@ int main(int argc, char *argv[]){
                 printf("Need 3 arguments: sample string and 2 other strings\n");
                 exit(1);
             } else {
-                // buff= (char*)malloc(BUFFER_SZ);
-                // old_string = argv[3];
-                // old_str_len = setup_buff()
-                // new_string = argv[4];
-                // new_str_len = setup_buff(buff, new_string, BUFFER_SZ);
+                // char *old_string = argv[3];
+                // char *new_string = argv[4];
+
                 printf("Not Implemented\n");
                 break;   
             }