diff --git a/allocate.c b/allocate.c
index 5978b119b683403f61e794ad12b84ae0c9c224a0..e929108820e894daae56a8dd2fb601d921f1140a 100644
--- a/allocate.c
+++ b/allocate.c
@@ -81,15 +81,18 @@ int main(int argc, char *argv[]) {
         }
     }
 
+    //  Initialize input file and arrival queue
     char line[36];
     arrivalLounge = llist_create(NULL);
     FILE *f = fopen(file, "r");
     process *headProcess;
     process *readAhead = malloc(sizeof(process));
+    //  read the first process in
     if (fgets(line, sizeof line, f) != NULL) {
         //initialize the first process just read
         initializeProcess(line, readAhead);
-    }
+    } else readAhead->timeArrived = -1;  // use -1 arrival to flag EOF
+
     //initialize CPUs
     CPU *CPUs = malloc(numCPU * sizeof(CPU));
     for (int i = 0; i < numCPU; i++) {
@@ -454,8 +457,9 @@ process *getNextProcess(FILE *f, llist *arrivals, process *readAhead) {
 
     //checking if at the end of the file
     if (fgets(line, sizeof line, f) == NULL && readAhead->timeArrived != -1 ) { //read EOF && readAhead != NULL
-        memcpy(nextProcess,readAhead, sizeof(process));
-        llist_add_inorder(nextProcess, arrivals, (int (*)(void *, void *)) &leastExecutionTime);
+//        memcpy(nextProcess,readAhead, sizeof(process));
+//        llist_add_inorder(nextProcess, arrivals, (int (*)(void *, void *)) &leastExecutionTime);
+        llist_add_inorder(readAhead, arrivals, (int (*)(void *, void *)) &leastExecutionTime);
         readAhead->timeArrived = -1;
         //free(readAhead);
         //initializeProcess(NULL,readAhead);