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..60f6274a73577d19a9fc679b3c85e746e2720187 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -3,14 +3,20 @@ 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.
+<<<<<<< HEAD
 PROGS = cat cmp cp echo halt hex-dump ls mcat mcp mkdir pwd rm shell \
 	bubsort insult lineup matmult recursor my touch
+=======
+PROGS = cat cmp cp echo exit halt hex-dump ls mcat mcp mkdir pwd rm shell \
+	bubsort insult lineup matmult recursor my
+>>>>>>> Alex/exit-system-call
 
 # Should work from project 2 onward.
 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 b/examples/exit
new file mode 100755
index 0000000000000000000000000000000000000000..0c6b2095bce3a8d234f5b4475d65b69ecdef1d3b
Binary files /dev/null and b/examples/exit differ
diff --git a/examples/exit.c b/examples/exit.c
new file mode 100644
index 0000000000000000000000000000000000000000..2a45b770b0d8a9576c9cb5e8c4cd932edd5418b9
--- /dev/null
+++ b/examples/exit.c
@@ -0,0 +1,14 @@
+/* halt.c
+
+   Simple program to test whether running a user program works.
+ 	
+   Just invokes a system call that shuts down the OS. */
+
+#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..3109de5b45953bae32f75ddd27790c5f7bfececc 100644
--- a/userprog/syscall_exit.c
+++ b/userprog/syscall_exit.c
@@ -1,6 +1,24 @@
+/*
+ * 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;	// creates thread struct from thread.h
+	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
+	f->eax = -1; // Returning -1 for success
+}
\ No newline at end of file
diff --git a/userprog/system_calls.h b/userprog/system_calls.h
index 6fadcd1f7e3d556e4884521bb746da97de11b6e0..daed0eda12434a3bebc1b41db4999e293cb1ebed 100644
--- a/userprog/system_calls.h
+++ b/userprog/system_calls.h
@@ -12,7 +12,7 @@ void syscall_halt(struct intr_frame *f);
  * returned. Conventionally, a status of 0 indicates success and nonzero
  * values indicate errors. 
  */
-void syscall_exit(struct intr_frame *f);
+void syscall_exit(struct intr_frame *status);
 
 /*
  * Runs the executable whose name is given in cmd_line, passing any given