diff --git a/.gitignore b/.gitignore
index b3ddb41aedfbab8bc3f8b59716dae0f5caa67134..fe0418548e417b12762d21108b1480b3e67fb620 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,4 @@ examples/libc.a
 examples/my
 # Visual Studio folder
 /.vs
+/CppProperties.json
diff --git a/examples/Makefile b/examples/Makefile
index f2243272fdebdd343b5ed47bcd38afbd8a1c3087..37678a85f28246985ca2e24a445363f93de84999 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -3,7 +3,7 @@ SRCDIR = ..
 # Test programs to compile, and a list of sources for each.
 # To add a new test, put its name on the PROGS list
 # and then add a name_SRC line that lists its source files.
-PROGS = cat cmp cp echo halt hex-dump ls mcat mcp mkdir pwd rm shell \
+PROGS = cat cmp cp echo exit halt hex-dump ls mcat mcp mkdir pwd rm shell \
 	bubsort insult lineup matmult recursor my touch
 
 # Should work from project 2 onward.
@@ -11,6 +11,7 @@ cat_SRC = cat.c
 cmp_SRC = cmp.c
 cp_SRC = cp.c
 echo_SRC = echo.c
+exit_SRC = exit.c
 halt_SRC = halt.c
 hex-dump_SRC = hex-dump.c
 insult_SRC = insult.c
diff --git a/examples/exit.c b/examples/exit.c
new file mode 100644
index 0000000000000000000000000000000000000000..960fe22452edaa8402db7e1df5b8783fa5898f5f
--- /dev/null
+++ b/examples/exit.c
@@ -0,0 +1,14 @@
+/* exit.c
+
+   Simple program to test whether running a user program works.
+ 	
+   Invokes the exit syscall to test if it works */
+
+#include <syscall.h>
+
+int
+main (void)
+{
+  exit (5);
+  /* not reached */
+}
diff --git a/userprog/syscall.c b/userprog/syscall.c
index e96679fee225a048692debc300481ab70aba9dc6..c78175f256fa5a9e0b31bda1d2ae6fe2fb2bdd07 100644
--- a/userprog/syscall.c
+++ b/userprog/syscall.c
@@ -72,7 +72,7 @@ syscall_handler (struct intr_frame *f UNUSED)
     break;
   default:
     printf ("WARNING: Invalid Syscall (%d)\n", syscall_number);
+    thread_exit ();
   }
   // TODO: remove this call to exit as we don't want all syscalls to make the thread exit
-  thread_exit ();
 }
diff --git a/userprog/syscall_exit.c b/userprog/syscall_exit.c
index 07d917f5c66b91671f7c834b42a4be96aec40bd2..df33e356d6294b25294b2d02dec16c7870b2a3f8 100644
--- a/userprog/syscall_exit.c
+++ b/userprog/syscall_exit.c
@@ -1,6 +1,20 @@
+/*
+ * Terminates the current user program, returning status to the kernel. If the
+ * Process’s parent waits for it (see below), this is the status that will be
+ * Returned. Conventionally, a status of 0 indicates success and nonzero values
+ * Indicate errors.
+ *
+ * Authored by Alex Stratford
+ */
+
 #include "system_calls.h"
-#include "threads/interrupt.h"
+#include "threads/interrupt.h" // Dependency for intr_frame struct
+#include "threads/thread.h" // Dependency for thread struct
 
 void syscall_exit(struct intr_frame *f) {
-  (void*)0;
-}
+	struct thread *current_thread = thread_current(); // Sets current thread
+	// pop off first int argument from interrupt frame
+	int exit_code = *((int*)f->esp + 1);
+	current_thread->exit_code = exit_code; // Returns exit code to kernel
+	thread_exit(); // Exiting current thread
+}
\ No newline at end of file