diff --git a/student-distrib/lib.c b/student-distrib/lib.c
index b0cb78d7972f89f97be2068b2e527360462a7f54..e757d7fd6165c17e8b3442a423a7b2e87c8e0907 100644
--- a/student-distrib/lib.c
+++ b/student-distrib/lib.c
@@ -34,6 +34,9 @@ void update_cursor(int32_t term_id)
 {
     term_id = visible_terminal;
     uint16_t position =  terminal[term_id].terminal_y * NUM_COLS +  terminal[term_id].terminal_x;
+
+    //HEX values copied from https://wiki.osdev.org/Text_Mode_Cursor
+
     outb(0x0F, 0x3D4);
     outb((uint8_t)(position&0xFF), 0x3D5);
     outb(0x0E, 0x3D4);
diff --git a/student-distrib/proc.c b/student-distrib/proc.c
index b8792dc2aa369eff0fe7989d0027e2ff4765c22d..2fcf4cbfa8037188f5ac9171a1b02dc342cf0671 100644
--- a/student-distrib/proc.c
+++ b/student-distrib/proc.c
@@ -34,9 +34,8 @@ void control_initilization(void)
 
      total_prog_count  = 0;
      visible_terminal  = 0;
-     running_terminal  = 0;
+     running_terminal  = 1; // initialized to 1 so we end in the first shell
      cur_pid           = 0;
-     counter           = 0;
 }
 
 /* The file descriptor table checking function
@@ -198,7 +197,7 @@ int32_t parse_cmd(const uint8_t* command, uint8_t* parsed_cmd, uint8_t (*argv)[M
 
     /* copy command to parsed_cmd */
     for (i = 0; i < (end - start); i++)
-        if(command[i+start] != 0x0D) //check for \n
+        if(command[i+start] != 0x0D) //0x0D = \n
             parsed_cmd[i] = command[i+start];
 
     command_length = strlen((int8_t*)command);
@@ -236,7 +235,7 @@ int32_t parse_cmd(const uint8_t* command, uint8_t* parsed_cmd, uint8_t (*argv)[M
 
         /* copy argument to return array */
         for (i = 0; i < (end - start); i++)
-            if(command[i+start] != 0x0D) //check for \n
+            if(command[i+start] != 0x0D) //0x0D = \n
                 argv[j][i] = command[i+start];
 
     }
diff --git a/student-distrib/rtc.c b/student-distrib/rtc.c
index c99778c333c90245f468372aa3b37b742aae27cd..063167bc3f619c5c7eea183730051a30a300d944 100644
--- a/student-distrib/rtc.c
+++ b/student-distrib/rtc.c
@@ -80,9 +80,9 @@ void rtc_interrupt(void)
  */
 int32_t rtc_read(int32_t fd, void* buf, int32_t nbytes)
 {
-
     /* Set flag */
-    rtc_flag[running_terminal] = 1;
+    if(rtc_active[running_terminal] == 1)
+        rtc_flag[running_terminal] = 1;
 
     
     sti();
@@ -130,38 +130,6 @@ int32_t rtc_write(int32_t fd, const void* buf, int32_t nbytes)
 
     rtc_init_counter[running_terminal] = rtc_counter[running_terminal];
 
-    // /* Translate frequency to rate */
-
-    // temp_freq = freq;
-
-    // for (i = 1; i <=  MAX_FREQ_POW; i++)
-    // {
-    //     temp_freq = temp_freq >> 1;
-
-    //     if ((temp_freq & bit_mask) == 1)
-    //     {
-    //         rate = RATE_OFFSET - i;
-    //         break;
-    //     }
-    //     //temp_freq = temp_freq >> 1;
-    // }
-
-    // /* Set the rate */
-    // rate &= 0x0F;
-
-    // /* Disable interrupts */
-    // cli();
-    // /* set index to register A, disable NMI */
-    // outb(DISABLE_NMI_A, RTC_PORT);
-    // /* get initial value of register A */
-    // prev = inb(RTC_DATA);
-    // /* reset index to A */
-    // outb(DISABLE_NMI_A, RTC_PORT);
-    // /* write only our rate to A. Note, rate is the bottom 4 bits. */
-    // outb((prev & 0xF0) | rate, RTC_DATA);
-    // /* Enable interrupts */
-    // sti();
-
     /* Return number of bytes written */
     return FOUR_BYTES;
 }
@@ -183,38 +151,16 @@ int32_t rtc_open(const uint8_t* filename)
     rtc_init_counter[running_terminal] = rtc_counter[running_terminal];
 
     return 0;
-
-
-    // uint8_t rate, prev;
-
-    // /* Set the frequency to 2 Hz */
-    // rate = TWO_HZ; 
-    // rate &= 0x0F;
-
-    // /* Disable interrupts */
-    // cli();
-    // /* set index to register A, disable NMI */
-    // outb(DISABLE_NMI_A, RTC_PORT);
-    // /* get initial value of register A */
-    // prev = inb(RTC_DATA);
-    // /* reset index to A */
-    // outb(DISABLE_NMI_A, RTC_PORT);
-    // /* write only our rate to A. Note, rate is the bottom 4 bits. */
-    // outb((prev & 0xF0) | rate, RTC_DATA);
-    // /* Enable interrupts */
-    // sti();
-    
-    // return 0;
 }
 
 /* rtc_close()
- * Inputs: fd - file descriptor       
+ * Inputs: fd - file descriptor
  * Return Value: returns 0
- * Function: *Not virtualized yet*  
+ * Function: *Not virtualized yet*
  */
 int32_t rtc_close(int32_t fd)
 {
-    /* Not virtualised yet */
+    rtc_active[running_terminal] = 0;
     return 0;
 }
 
diff --git a/student-distrib/scheduler.c b/student-distrib/scheduler.c
index a2cf7019df20a4dca2dd4ee84c021b813b0e0f98..89861d143c8d4f98b874bd7ec25a11ea2843f1b8 100644
--- a/student-distrib/scheduler.c
+++ b/student-distrib/scheduler.c
@@ -2,14 +2,17 @@
 
 /* The scheduler function
  *
- * DISCRIPTION: This function switch running process every 15 ms
- *
+ * DESCRIPTION: This function switch running process every 15 ms
+ * Input: NONE
+ * Output: NONE
+ * Side Effects: switches processes
  */
 void scheduler(void){
 
-    // Bookkeeping
+    // get current pcb
     pcb_t * curr_pcb = terminal[running_terminal].pcb;
 
+    // check if no program is running on that terminal
     if(curr_pcb == NULL)
     {
 
@@ -18,6 +21,7 @@ void scheduler(void){
         pcb_t pcb;
         pcb.scheduler_flag = 1;
 
+        //move esp and ebp to pcb
         asm volatile(
             "movl %%esp, %0       \n"
             "movl %%ebp, %1       \n"
@@ -26,17 +30,22 @@ void scheduler(void){
             : "memory"
         );
 
+        // set pointer to terminal pcb
         terminal[running_terminal].pcb = &pcb;
 
+        // perform terminal switch to the next terminal
         switch_terminal(running_terminal);
 
-        printf("terminal = %d\n", running_terminal);
+        printf("terminal = %d\n", running_terminal+1);
 
+        // send PIT eoi now because we don't return here after execute
         send_eoi(PIT_IRQ);
 
+        // start shell
         execute((uint8_t *)"shell");
     }
 
+    // save esp and ebp of old process
     asm volatile(
         "movl %%esp, %0       \n"
         "movl %%ebp, %1       \n"
@@ -46,34 +55,42 @@ void scheduler(void){
     );
 
     // Round Robin
-    running_terminal = (running_terminal + 1) % 3;
+    running_terminal = (running_terminal + 1) % MAX_TERMINAL;
 
+    // check again for non initialized pcb
     if(terminal[running_terminal].pcb == NULL)
     {
         send_eoi(PIT_IRQ);
         return;
     }
 
+    // remap video memory
     remap_vidmem();
+
+    // adjust memory for terminals
     store_vid_mem(running_terminal);
 
+    // get next process
     pcb_t* next_pcb = terminal[running_terminal].pcb;
 
     // update current pid, tss and remap paging
     remap_proc(next_pcb->pid);
 
+    // store kernel stack segment and esp
     tss.ss0 = KERNEL_DS;
     tss.esp0 = _8_MB - _8_KB * (next_pcb->pid);
 
+    // send PIT eoi now because we don't return here
     send_eoi(PIT_IRQ);
 
+    // perform process switch by changing esp and ebp
     asm volatile(
-        //change esp and ebp
         "movl %0, %%esp       \n"
         "movl %1, %%ebp       \n"
         :
         : "r" (next_pcb->current_esp), "r" (next_pcb->current_ebp)
         : "esp" , "ebp"
     );
-    // printf("[SCHEDULE] after ebp and esp breaking");
+
+    return;
 }
diff --git a/student-distrib/syscall.c b/student-distrib/syscall.c
index 30b9d1873fd40e7619169ab6081d3070e42ddff8..142bf7cf56e95c8c7d23595fe88bc988cdc851e3 100644
--- a/student-distrib/syscall.c
+++ b/student-distrib/syscall.c
@@ -21,6 +21,7 @@ int32_t halt (uint8_t status) {
     /* set all present flags in PCB to "Not In Use" */
     for (i = 0; i < MAX_FILE_NUM; i++)
     {
+        // close all files for current pcb
         if( i > 1 && pcb_cur->fd[i].flags == 1 )
             close(i);
 
@@ -452,9 +453,9 @@ int32_t vidmap (uint8_t** screen_start)
 
     remap_vidmem();
 
-    *screen_start = (uint8_t *)(0x8400000); // 132MB, video memory starting address
+    *screen_start = (uint8_t *)(_132_MB); // 132MB, video memory starting address
 
-    return 0x8400000;
+    return _132_MB;
 }
 
 /*
diff --git a/student-distrib/types.h b/student-distrib/types.h
index 110fb31005a3c28061d45d28e5501360e0285169..a78a8cdc555bf0e9a911cd754f366dab3a353751 100644
--- a/student-distrib/types.h
+++ b/student-distrib/types.h
@@ -141,25 +141,24 @@ typedef struct file_object {
 /* Process control block structure */
 typedef struct pcb {
 
-    file_object_t   fd[MAX_FILE_NUM]; /* File descriptor array */
+    file_object_t   fd[MAX_FILE_NUM];                          /* File descriptor array */
 
-    int32_t         shell_flag;
-    int32_t         scheduler_flag;
+    int32_t         shell_flag;                                /* indicates if pcb is shell */
+    int32_t         scheduler_flag;                            /* overrides esp and ebp setting in pcb_init */
 
-    uint32_t        pid;                    /* Holds current process ID */
-    uint32_t        current_esp;            /* Store Current esp for scheduling */
-    uint32_t        current_ebp;            /* Store Current ebp for scheduling */
-    uint32_t        current_eip;            /* Store Current eip for scheduling */
+    uint32_t        pid;                                       /* Holds current process ID */
+    uint32_t        current_esp;                               /* Store Current esp for scheduling */
+    uint32_t        current_ebp;                               /* Store Current ebp for scheduling */
 
     struct pcb*     parent_pcb;
-    uint32_t        parent_pid;             /* Holds parent process ID */
-    uint32_t        parent_esp;             /* Stores Kernel ESP, EBP*/
-    uint32_t        parent_ebp;             /* Stores Kernel ESP, EBP*/
-
-    uint32_t        tss_esp0;               /* saves TSS before context switch */
-
-    uint32_t        arg_num;                /* Number of arguments in argv */
-    uint8_t         cmd[MAX_COMMAND_SIZE];  /* Command */
+    uint32_t        parent_pid;                                /* Holds parent process ID */
+    uint32_t        parent_esp;                                /* Stores Kernel ESP, EBP*/
+    uint32_t        parent_ebp;                                /* Stores Kernel ESP, EBP*/
+                   
+    uint32_t        tss_esp0;                                  /* saves TSS before context switch */
+                   
+    uint32_t        arg_num;                                   /* Number of arguments in argv */
+    uint8_t         cmd[MAX_COMMAND_SIZE];                     /* Command */
     uint8_t         argv[MAX_ARGUMENT_NUM][MAX_ARGUMENT_SIZE]; /* Argument table */
 
 } pcb_t;
@@ -184,7 +183,6 @@ volatile int32_t    buffer_index;
 /*---------------------------- Global variable -------------------------------*/
 
     uint32_t    filesys_start;              /* Starting place for file system */
-    int32_t     counter;                    /* */
 
     terminal_t  terminal[MAX_TERMINAL];     /* Terminal array that store the information for each termianl */
     int32_t     visible_terminal;           /* */