diff --git a/include/buffer.h b/include/buffer.h
index 144ee4b35ec56c236d2e8da8e896635c07cc4ed2..2167cc068c2e9701d90f2c06e0cc9ef4ca3158ec 100644
--- a/include/buffer.h
+++ b/include/buffer.h
@@ -1,14 +1,26 @@
 #ifndef BUFFER_H
 #define BUFFER_H
 
-// FIFO queue
+// General Purpose buffer
 
-Pair* MakePair(int TaskID, char* Msg);
+// returns 1 if buffer is ready(not null, has memory)
+int BufferReady(Buffer* Buf);
 
-void PushToBuffer(Buffer B, int TaskID, char* Msg);
+// insert at the last
+int FeedBuffer(Buffer* Buf,void* Word);
 
-Pair* FrontBuffer(Buffer* B);
+// Get from the start, does not change size
+int BufferFIFO(Buffer* Buf, void* Dest);
 
-int PopFrontBuffer(Buffer* B);
+int BufferPopStart(Buffer* Buf);
 
-#endif
\ No newline at end of file
+// Get from the Last, does not change size
+int BufferFILO(Buffer* Buf, void* Dest);
+
+// Clear the Buffer, does not modify memory
+int ClearBuffer(Buffer* Buf);
+
+// pop out first Num of the buffer
+int BufferShrinkFIFO(Buffer* Buf, int Num);
+
+#endif
diff --git a/include/error.h b/include/error.h
new file mode 100644
index 0000000000000000000000000000000000000000..c40fafa99e81cf9da74187ed14210fa3307aa4d6
--- /dev/null
+++ b/include/error.h
@@ -0,0 +1,15 @@
+#ifndef ERROR_H
+#define ERROR_H
+
+#define FAILURE -1
+#define SUCCESS 0
+
+#define HT_NOSLOT -11
+
+#define ILLEGAL_NAME -21
+
+#define BUFF_NOTREADY -30
+#define BUFF_FULL -31
+#define BUFF_EMPTY -32
+
+#endif
diff --git a/include/hash-table.h b/include/hash-table.h
new file mode 100644
index 0000000000000000000000000000000000000000..0d7843995cb4733de63004786e179f849dcda7ff
--- /dev/null
+++ b/include/hash-table.h
@@ -0,0 +1,10 @@
+#ifndef __TRIE_H__
+#define __TRIE_H__
+
+#include <types.h>
+
+int InsertTo(HT* Table,int Tid, char* Str, int Len);
+
+int TrieLookup(HT* Table,char* Str, int Len);
+
+#endif
diff --git a/include/k2.h b/include/k2.h
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/include/timer.h b/include/timer.h
index 63bd59d4d8780be463e2f9560157846ae7f6d79d..90eae64023468722f959cafb17f8713c3f60e492 100644
--- a/include/timer.h
+++ b/include/timer.h
@@ -1,8 +1,14 @@
 #ifndef TIMER_H
 #define TIMER_H
 
-void TimerInit();
+#define CLOCK_LOAD_VALUE 50800
 
-void TimerUpdate();
+#define SLOW_LOAD_VALUE 200
 
-#endif
\ No newline at end of file
+#define TIMER_LOAD_VALUE 508000;
+
+void ClockInit(Clock *MyClock);
+
+void ClockUpdate(Clock *MyClock);
+
+#endif
diff --git a/include/types.h b/include/types.h
index f4eb4ac9dcaaf83134450cb23f33438910bb50e4..1c6b4199c1a06542bb0a1bc5b083df5e3849050b 100644
--- a/include/types.h
+++ b/include/types.h
@@ -23,19 +23,51 @@
 #define NAMESERVER_TID_INVALID -1
 #define MAX_NUM_BUFFER 20
 
-typedef struct pair {
-    int TaskID;
-    char* Msg;
-    Pair* Next;
-} Pair;
+
+#define NAME_LENGTH_MAX 16
+
+#define HASH_SIZE 257
+
+
+
+typedef struct ArgumentPack{
+  void * arg0;
+  void * arg1;
+  void * arg2;
+  void * arg3;
+  void * arg4;
+}AP;
+
 
 typedef struct buffer {
-    Pair* Head;
-    Pair* Tail;
-    int Num;
+  void * Storage;
+  int size;
+  int Length;
+  int Head;
+  int Tail;
 } Buffer;
 
-typedef struct NameServerMessageType {
+
+typedef struct
+{
+  unsigned int ClockCount;
+  unsigned int LastTimerValue;
+  char bChanged;
+}Clock;
+
+
+typedef struct hash_table{
+  int *TidSequence;
+  char **NameSequence;
+  int size;
+}HT;
+
+typedef struct NameServerMessage {
+    char Msg[NS_MESSAGE_MAX_LENGTH];
+} NSMsg;
+
+
+typedef enum NameServerMessageType {
     WhoIs,
     RegisterAs
 } NSMsgType;
@@ -46,28 +78,14 @@ typedef struct NameServerRequest{
     NSMsgType MsgType;
 } NSReq;
 
-typedef struct NameServerMessage {
-    char Msg[NS_MESSAGE_MAX_LENGTH];
-} NSMsg;
 
-typedef struct ArgumentPack{
-  void * arg0;
-  void * arg1;
-  void * arg2;
-  void * arg3;
-  void * arg4;
-}AP;
 
-typedef enum taskstate {
-    Active, 
-    Ready, 
-    Blocked,
-    Init,
-    Zombie,
-    SendBlocked,
-    ReceiveBlocked,
-    ReplyBlocked
-} State;
+typedef struct pair {
+    int TaskID;
+    char* Msg;
+    Pair* Next;
+} Pair;
+
 
 typedef enum prioritylvl {
     Prio0,
@@ -80,6 +98,34 @@ typedef enum prioritylvl {
     Prio7
 } PrioLvl;
 
+
+typedef enum syscall {
+    SYS_Create,
+    SYS_MyTid,
+    SYS_ParentTid,
+    SYS_Pass,
+    SYS_Exit,
+    SYS_Send,
+    SYS_Receive,
+    SYS_Reply,
+    SYS_RecordNS,
+    SYS_WHOIS,
+    SYS_REGAS,
+} Syscall;
+
+
+typedef enum taskstate {
+    Active, 
+    Ready, 
+    Blocked,
+    Init,
+    Zombie,
+    SendBlocked,
+    ReceiveBlocked,
+    ReplyBlocked
+} State;
+
+
 struct taskDescriptor {
 
   int* sp; //sp_usr
@@ -115,17 +161,8 @@ typedef struct kernel {
     TD* FirstOfFreeList;
     TD* LastOfFreeList;
     int NumTDsAvail;
+  int NameServerID;
 } KernelStruct;
 
-typedef enum syscall {
-    SYS_Create,
-    SYS_MyTid,
-    SYS_ParentTid,
-    SYS_Pass,
-    SYS_Exit,
-    SYS_Send,
-    SYS_Receive,
-    SYS_Reply
-} Syscall;
 
 #endif
diff --git a/lib/Makefile b/lib/Makefile
index 18717fead7876ebcb6c23178dadfc9d29ed09906..c89685baf83ae29d7ee983b408a84351a4268320 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -41,10 +41,17 @@ syscall.s: syscall.c
 syscall-handler.s: syscall-handler.c
 	$(XCC) -S $(CFLAGS) syscall-handler.c
 
-
 td.s: td.c
 	$(XCC) -S $(CFLAGS) td.c
 
+timer.s: timer.c
+	$(XCC) -S $(CFLAGS) timer.c
+
+
+hash-table.s: hash-table.c
+	$(XCC) -S $(CFLAGS) hash-table.c
+
+
 bwio.o: bwio.s
 	$(AS) $(ASFLAGS) -o bwio.o bwio.s
 
@@ -73,6 +80,12 @@ syscall-handler.o: syscall-handler.s
 td.o: td.s
 	$(AS) $(ASFLAGS) -o td.o td.s
 
+timer.o: timer.s
+	$(AS) $(ASFLAGS) -o timer.o timer.s
+
+hash-table.o: hash-table.s
+	$(AS) $(ASFLAGS) -o hash-table.o hash-table.s
+
 
 bwio.a: bwio.o
 	$(AR) $(ARFLAGS) $@ bwio.o
@@ -101,8 +114,14 @@ syscall-handler.a: syscall-handler.o
 td.a: td.o
 	$(AR) $(ARFLAGS) $@ td.o
 
+timer.a: timer.o
+	$(AR) $(ARFLAGS) $@ timer.o
+
+hash-table.a: hash-table.o
+	$(AR) $(ARFLAGS) $@ hash-table.o
+
 
-install: bwio.a context-switch.a kernel.a k1.a priority-q.a scheduler.a syscall.a syscall-handler.a td.a 
+install: bwio.a timer.a context-switch.a kernel.a k1.a priority-q.a scheduler.a syscall.a syscall-handler.a td.a hash-table.a 
 	mv bwio.a libbwio.a
 	mv context-switch.a libcs.a
 	mv k1.a libk1.a
@@ -112,8 +131,10 @@ install: bwio.a context-switch.a kernel.a k1.a priority-q.a scheduler.a syscall.
 	mv syscall.a libsys.a
 	mv syscall-handler.a libsysh.a
 	mv td.a libtd.a
+	mv timer.a libtimer.a
+	mv hash-table.a libht.a
 	#mv test.a libtest.a
 clean:
 	mv context-switch.s ct
-	-rm -f *s *.o *.a *~ ../../lib/*.a
+	-rm -f *s *.o *.a *~
 	mv ct context-switch.s
diff --git a/lib/buffer.c b/lib/buffer.c
index 6369d7622e6dc92ec424f697e5d81270ce72a72c..fde2c7289efd5ac75edce8cc06d7d1828c849517 100644
--- a/lib/buffer.c
+++ b/lib/buffer.c
@@ -1,41 +1,74 @@
 #include <buffer.h>
 #include <types.h>
 
-void BufferInit(Buffer* B) {
-    B->Num = 0;
-}
-
-Pair* MakePair(int TaskID, char* Msg) {
-    Pair* P;
-    P->TaskID = TaskID;
-    P->Msg = Msg;
-    P->Next = NULL;
-    return P;
-}
-
-void PushToBuffer(Buffer* B, int TaskID, char* Msg) {
-    Pair* New = MakePair(TaskID, Msg);
-    if (B) {
-        if (B->Head == NULL) {
-            B->Head = New;
-            B->Tail = New;
-        }
-        else {
-            New->Next = B->Head;
-            B->Head = New;
-        }
-        B->Num += 1;
-    }
-}
-
-Pair* FrontBuffer(Buffer* B) {
-    if (B && B->Head) return B->Head;
-    return FAILURE;
-}
-
-int PopFrontBuffer(Buffer* B) {
-    if (B && B->Head) {
-        B->Head = B->Head->Next; 
-        B->Num -= 1;
-    } else return FAILURE;
+int BufferReady(Buffer* Buf){
+  int ready = ((Buf!=NULL) &&(Buf->Size >0))? 1:0;
+  return ready;
+}
+
+
+int FeedBuffer(Buffer* Buf,void* Word)
+{
+  if(BufferReady(Buf)){
+    if(Buf->Length == Buf->Size) return BUFF_FULL;
+    (Buf->Storage)[Buf->Tail] = *Word;
+    Buf->Tail = (Buf->Tail + 1) % (Buf->Size);
+    Buf->Length = Buf->Length + 1;
+    return 0;
+  }else return BUFF_NOTREADY;
+}
+
+int BufferFIFO(Buffer* Buf,void* Dest)
+{
+  if(BufferReady(Buf)){
+    if(Buf->Length == 0) return BUFF_EMPTY;
+    *Word = (Buf->Storage)[Buf->Head];
+    return 0;
+  }else return BUFF_NOTREADY;
+}
+int BufferPopHead(Buffer* Buf)
+{
+  if(BufferReady(Buf)){
+    if(Buf->Length == 0) return BUFF_EMPTY;
+    Buf->Head = (Buf->Head +1) % Buf->Size;
+    Buf->Length = (Buf->Length) - 1;
+    return 0;
+  }else return BUFF_NOTREADY;
+}
+
+int BufferFILO(Buffer* Buf, void* Dest)
+{
+  if(Buf->Size == 0) return  BUFF_NOTREADY;
+  if(Buf->Length == 0) return BUFF_EMPTY;
+  *Word = (Buf->Storage)[Buf->Tail];
+  return 0;
+}
+
+int BufferPopLast(Buffer* Buf)
+{
+  if(BufferReady(Buf)){
+    if(Buf->Length == 0) return BUFF_EMPTY;
+    Buf->Tail = (Buf->Tail - 1 + Buf->Size) % Buf->Size;
+    Buf->Length = (Buf->Length) - 1;
+    return 0;
+  }else return BUFF_NOTREADY;
+}
+
+int ClearBuffer(Buffer* Buf)
+{
+  if(BufferReady(Buf)){
+    Buf->Length = 0;
+    Buf->Tail = Buf->Head;
+    return 0;
+  }else return BUFF_NOTREADY;
+}
+
+int BufferShrinkFIFO(Buffer* Buf, int Num)
+{
+  if(BufferReady(Buf)){
+    int ActualShrink = (Num > Buf->Length)? (Buf->Length): Num;
+    Buf->Length = Buf->Length - ActualShrink;
+    Buf->Head = (Buf->Head + ActualShrink) % Buf->Size;
+    return 0;
+  }else return BUFF_NOTREADY;
 }
diff --git a/lib/bwio.o b/lib/bwio.o
deleted file mode 100644
index 1f01e290b85e1e1a3aedabe0cb298ef39089b2f4..0000000000000000000000000000000000000000
Binary files a/lib/bwio.o and /dev/null differ
diff --git a/lib/bwio.s b/lib/bwio.s
deleted file mode 100644
index 11317325ffb0ede5c4f5b9a8861dd4c4f912516e..0000000000000000000000000000000000000000
--- a/lib/bwio.s
+++ /dev/null
@@ -1,982 +0,0 @@
-	.file	"bwio.c"
-	.text
-	.align	2
-	.global	bwsetfifo
-	.type	bwsetfifo, %function
-bwsetfifo:
-	@ args = 0, pretend = 0, frame = 28
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #28
-	str	r0, [fp, #-24]
-	str	r1, [fp, #-28]
-	ldr	r3, [fp, #-24]
-	str	r3, [fp, #-40]
-	ldr	r3, [fp, #-40]
-	cmp	r3, #0
-	beq	.L3
-	ldr	r3, [fp, #-40]
-	cmp	r3, #1
-	beq	.L4
-	b	.L2
-.L3:
-	ldr	r3, .L11
-	str	r3, [fp, #-20]
-	b	.L5
-.L4:
-	ldr	r3, .L11+4
-	str	r3, [fp, #-20]
-	b	.L5
-.L2:
-	mvn	r3, #0
-	str	r3, [fp, #-36]
-	b	.L6
-.L5:
-	ldr	r3, [fp, #-20]
-	ldr	r3, [r3, #0]
-	str	r3, [fp, #-16]
-	ldr	r3, [fp, #-28]
-	cmp	r3, #0
-	beq	.L7
-	ldr	r3, [fp, #-16]
-	orr	r3, r3, #16
-	str	r3, [fp, #-32]
-	b	.L9
-.L7:
-	ldr	r3, [fp, #-16]
-	bic	r3, r3, #16
-	str	r3, [fp, #-32]
-.L9:
-	ldr	r3, [fp, #-32]
-	str	r3, [fp, #-16]
-	ldr	r2, [fp, #-20]
-	ldr	r3, [fp, #-16]
-	str	r3, [r2, #0]
-	mov	r3, #0
-	str	r3, [fp, #-36]
-.L6:
-	ldr	r3, [fp, #-36]
-	mov	r0, r3
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-.L12:
-	.align	2
-.L11:
-	.word	-2138308600
-	.word	-2138243064
-	.size	bwsetfifo, .-bwsetfifo
-	.align	2
-	.global	bwsetspeed
-	.type	bwsetspeed, %function
-bwsetspeed:
-	@ args = 0, pretend = 0, frame = 28
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #28
-	str	r0, [fp, #-24]
-	str	r1, [fp, #-28]
-	ldr	r2, [fp, #-24]
-	str	r2, [fp, #-36]
-	ldr	r3, [fp, #-36]
-	cmp	r3, #0
-	beq	.L15
-	ldr	r2, [fp, #-36]
-	cmp	r2, #1
-	beq	.L16
-	b	.L14
-.L15:
-	ldr	r3, .L23
-	str	r3, [fp, #-20]
-	ldr	r3, .L23+4
-	str	r3, [fp, #-16]
-	b	.L17
-.L16:
-	ldr	r3, .L23+8
-	str	r3, [fp, #-20]
-	ldr	r3, .L23+12
-	str	r3, [fp, #-16]
-	b	.L17
-.L14:
-	mvn	r3, #0
-	str	r3, [fp, #-32]
-	b	.L18
-.L17:
-	ldr	r2, [fp, #-28]
-	str	r2, [fp, #-40]
-	ldr	r3, [fp, #-40]
-	cmp	r3, #2400
-	beq	.L20
-	ldr	r3, .L23+16
-	ldr	r2, [fp, #-40]
-	cmp	r2, r3
-	beq	.L21
-	b	.L19
-.L21:
-	ldr	r2, [fp, #-20]
-	mov	r3, #0
-	str	r3, [r2, #0]
-	ldr	r2, [fp, #-16]
-	mov	r3, #3
-	str	r3, [r2, #0]
-	mov	r3, #0
-	str	r3, [fp, #-32]
-	b	.L18
-.L20:
-	ldr	r2, [fp, #-20]
-	mov	r3, #0
-	str	r3, [r2, #0]
-	ldr	r2, [fp, #-16]
-	mov	r3, #191
-	str	r3, [r2, #0]
-	mov	r2, #0
-	str	r2, [fp, #-32]
-	b	.L18
-.L19:
-	mvn	r3, #0
-	str	r3, [fp, #-32]
-.L18:
-	ldr	r3, [fp, #-32]
-	mov	r0, r3
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-.L24:
-	.align	2
-.L23:
-	.word	-2138308596
-	.word	-2138308592
-	.word	-2138243060
-	.word	-2138243056
-	.word	115200
-	.size	bwsetspeed, .-bwsetspeed
-	.align	2
-	.global	bwputc
-	.type	bwputc, %function
-bwputc:
-	@ args = 0, pretend = 0, frame = 24
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #24
-	str	r0, [fp, #-24]
-	mov	r3, r1
-	strb	r3, [fp, #-28]
-	ldr	r3, [fp, #-24]
-	str	r3, [fp, #-36]
-	ldr	r3, [fp, #-36]
-	cmp	r3, #0
-	beq	.L27
-	ldr	r3, [fp, #-36]
-	cmp	r3, #1
-	beq	.L28
-	b	.L26
-.L27:
-	ldr	r3, .L33
-	str	r3, [fp, #-20]
-	ldr	r3, .L33+4
-	str	r3, [fp, #-16]
-	b	.L29
-.L28:
-	ldr	r3, .L33+8
-	str	r3, [fp, #-20]
-	ldr	r3, .L33+12
-	str	r3, [fp, #-16]
-	b	.L29
-.L26:
-	mvn	r3, #0
-	str	r3, [fp, #-32]
-	b	.L30
-.L29:
-	ldr	r3, [fp, #-20]
-	ldr	r3, [r3, #0]
-	mov	r3, r3, lsr #5
-	and	r3, r3, #1
-	and	r3, r3, #255
-	cmp	r3, #0
-	bne	.L29
-	ldrb	r2, [fp, #-28]	@ zero_extendqisi2
-	ldr	r3, [fp, #-16]
-	str	r2, [r3, #0]
-	mov	r3, #0
-	str	r3, [fp, #-32]
-.L30:
-	ldr	r3, [fp, #-32]
-	mov	r0, r3
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-.L34:
-	.align	2
-.L33:
-	.word	-2138308584
-	.word	-2138308608
-	.word	-2138243048
-	.word	-2138243072
-	.size	bwputc, .-bwputc
-	.align	2
-	.global	c2x
-	.type	c2x, %function
-c2x:
-	@ args = 0, pretend = 0, frame = 8
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #8
-	mov	r3, r0
-	strb	r3, [fp, #-16]
-	ldrb	r3, [fp, #-16]	@ zero_extendqisi2
-	cmp	r3, #9
-	bhi	.L36
-	ldrb	r3, [fp, #-16]	@ zero_extendqisi2
-	add	r3, r3, #48
-	and	r3, r3, #255
-	and	r3, r3, #255
-	str	r3, [fp, #-20]
-	b	.L38
-.L36:
-	ldrb	r3, [fp, #-16]	@ zero_extendqisi2
-	add	r3, r3, #87
-	and	r3, r3, #255
-	and	r3, r3, #255
-	str	r3, [fp, #-20]
-.L38:
-	ldr	r3, [fp, #-20]
-	mov	r0, r3
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-	.size	c2x, .-c2x
-	.align	2
-	.global	bwputx
-	.type	bwputx, %function
-bwputx:
-	@ args = 0, pretend = 0, frame = 12
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #12
-	str	r0, [fp, #-20]
-	mov	r3, r1
-	strb	r3, [fp, #-24]
-	ldrb	r3, [fp, #-24]	@ zero_extendqisi2
-	mov	r3, r3, lsr #4
-	and	r3, r3, #255
-	mov	r0, r3
-	bl	c2x(PLT)
-	mov	r3, r0
-	strb	r3, [fp, #-14]
-	ldrb	r3, [fp, #-24]	@ zero_extendqisi2
-	and	r3, r3, #15
-	mov	r0, r3
-	bl	c2x(PLT)
-	mov	r3, r0
-	strb	r3, [fp, #-13]
-	ldrb	r3, [fp, #-14]	@ zero_extendqisi2
-	ldr	r0, [fp, #-20]
-	mov	r1, r3
-	bl	bwputc(PLT)
-	ldrb	r3, [fp, #-13]	@ zero_extendqisi2
-	ldr	r0, [fp, #-20]
-	mov	r1, r3
-	bl	bwputc(PLT)
-	mov	r3, r0
-	mov	r0, r3
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-	.size	bwputx, .-bwputx
-	.align	2
-	.global	bwputr
-	.type	bwputr, %function
-bwputr:
-	@ args = 0, pretend = 0, frame = 16
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #16
-	str	r0, [fp, #-24]
-	str	r1, [fp, #-28]
-	sub	r3, fp, #28
-	str	r3, [fp, #-16]
-	mov	r3, #3
-	str	r3, [fp, #-20]
-	b	.L43
-.L44:
-	ldr	r3, [fp, #-20]
-	mov	r2, r3
-	ldr	r3, [fp, #-16]
-	add	r3, r2, r3
-	ldrb	r3, [r3, #0]	@ zero_extendqisi2
-	ldr	r0, [fp, #-24]
-	mov	r1, r3
-	bl	bwputx(PLT)
-	ldr	r3, [fp, #-20]
-	sub	r3, r3, #1
-	str	r3, [fp, #-20]
-.L43:
-	ldr	r3, [fp, #-20]
-	cmp	r3, #0
-	bge	.L44
-	ldr	r0, [fp, #-24]
-	mov	r1, #32
-	bl	bwputc(PLT)
-	mov	r3, r0
-	mov	r0, r3
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-	.size	bwputr, .-bwputr
-	.align	2
-	.global	bwputstr
-	.type	bwputstr, %function
-bwputstr:
-	@ args = 0, pretend = 0, frame = 12
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #12
-	str	r0, [fp, #-16]
-	str	r1, [fp, #-20]
-	b	.L48
-.L49:
-	ldr	r3, [fp, #-20]
-	ldrb	r3, [r3, #0]	@ zero_extendqisi2
-	ldr	r0, [fp, #-16]
-	mov	r1, r3
-	bl	bwputc(PLT)
-	mov	r3, r0
-	cmp	r3, #0
-	bge	.L50
-	mvn	r3, #0
-	str	r3, [fp, #-24]
-	b	.L52
-.L50:
-	ldr	r3, [fp, #-20]
-	add	r3, r3, #1
-	str	r3, [fp, #-20]
-.L48:
-	ldr	r3, [fp, #-20]
-	ldrb	r3, [r3, #0]	@ zero_extendqisi2
-	cmp	r3, #0
-	bne	.L49
-	mov	r3, #0
-	str	r3, [fp, #-24]
-.L52:
-	ldr	r3, [fp, #-24]
-	mov	r0, r3
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-	.size	bwputstr, .-bwputstr
-	.align	2
-	.global	bwputw
-	.type	bwputw, %function
-bwputw:
-	@ args = 0, pretend = 0, frame = 24
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #24
-	str	r0, [fp, #-24]
-	str	r1, [fp, #-28]
-	str	r3, [fp, #-36]
-	mov	r3, r2
-	strb	r3, [fp, #-32]
-	ldr	r3, [fp, #-36]
-	str	r3, [fp, #-16]
-	b	.L56
-.L57:
-	ldr	r3, [fp, #-28]
-	sub	r3, r3, #1
-	str	r3, [fp, #-28]
-.L56:
-	ldr	r3, [fp, #-16]
-	ldrb	r3, [r3, #0]	@ zero_extendqisi2
-	cmp	r3, #0
-	moveq	r3, #0
-	movne	r3, #1
-	and	r2, r3, #255
-	ldr	r3, [fp, #-16]
-	add	r3, r3, #1
-	str	r3, [fp, #-16]
-	eor	r3, r2, #1
-	and	r3, r3, #255
-	cmp	r3, #0
-	bne	.L60
-	ldr	r3, [fp, #-28]
-	cmp	r3, #0
-	bgt	.L57
-	b	.L60
-.L61:
-	ldrb	r3, [fp, #-32]	@ zero_extendqisi2
-	ldr	r0, [fp, #-24]
-	mov	r1, r3
-	bl	bwputc(PLT)
-.L60:
-	ldr	r3, [fp, #-28]
-	cmp	r3, #0
-	movle	r3, #0
-	movgt	r3, #1
-	and	r2, r3, #255
-	ldr	r3, [fp, #-28]
-	sub	r3, r3, #1
-	str	r3, [fp, #-28]
-	cmp	r2, #0
-	bne	.L61
-	b	.L63
-.L64:
-	ldrb	r3, [fp, #-17]	@ zero_extendqisi2
-	ldr	r0, [fp, #-24]
-	mov	r1, r3
-	bl	bwputc(PLT)
-.L63:
-	ldr	r3, [fp, #-36]
-	ldrb	r3, [r3, #0]
-	strb	r3, [fp, #-17]
-	ldrb	r3, [fp, #-17]	@ zero_extendqisi2
-	cmp	r3, #0
-	moveq	r3, #0
-	movne	r3, #1
-	and	r2, r3, #255
-	ldr	r3, [fp, #-36]
-	add	r3, r3, #1
-	str	r3, [fp, #-36]
-	cmp	r2, #0
-	bne	.L64
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-	.size	bwputw, .-bwputw
-	.align	2
-	.global	bwgetc
-	.type	bwgetc, %function
-bwgetc:
-	@ args = 0, pretend = 0, frame = 24
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #24
-	str	r0, [fp, #-28]
-	ldr	r3, [fp, #-28]
-	str	r3, [fp, #-36]
-	ldr	r3, [fp, #-36]
-	cmp	r3, #0
-	beq	.L69
-	ldr	r3, [fp, #-36]
-	cmp	r3, #1
-	beq	.L70
-	b	.L68
-.L69:
-	ldr	r3, .L75
-	str	r3, [fp, #-24]
-	ldr	r3, .L75+4
-	str	r3, [fp, #-20]
-	b	.L71
-.L70:
-	ldr	r3, .L75+8
-	str	r3, [fp, #-24]
-	ldr	r3, .L75+12
-	str	r3, [fp, #-20]
-	b	.L71
-.L68:
-	mvn	r3, #0
-	str	r3, [fp, #-32]
-	b	.L72
-.L71:
-	ldr	r3, [fp, #-24]
-	ldr	r3, [r3, #0]
-	mov	r3, r3, lsr #6
-	and	r3, r3, #1
-	cmp	r3, #0
-	beq	.L71
-	ldr	r3, [fp, #-20]
-	ldr	r3, [r3, #0]
-	strb	r3, [fp, #-13]
-	ldrb	r3, [fp, #-13]	@ zero_extendqisi2
-	str	r3, [fp, #-32]
-.L72:
-	ldr	r3, [fp, #-32]
-	mov	r0, r3
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-.L76:
-	.align	2
-.L75:
-	.word	-2138308584
-	.word	-2138308608
-	.word	-2138243048
-	.word	-2138243072
-	.size	bwgetc, .-bwgetc
-	.align	2
-	.global	bwa2d
-	.type	bwa2d, %function
-bwa2d:
-	@ args = 0, pretend = 0, frame = 8
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #8
-	mov	r3, r0
-	strb	r3, [fp, #-16]
-	ldrb	r3, [fp, #-16]	@ zero_extendqisi2
-	cmp	r3, #47
-	bls	.L78
-	ldrb	r3, [fp, #-16]	@ zero_extendqisi2
-	cmp	r3, #57
-	bhi	.L78
-	ldrb	r3, [fp, #-16]	@ zero_extendqisi2
-	sub	r3, r3, #48
-	str	r3, [fp, #-20]
-	b	.L81
-.L78:
-	ldrb	r3, [fp, #-16]	@ zero_extendqisi2
-	cmp	r3, #96
-	bls	.L82
-	ldrb	r3, [fp, #-16]	@ zero_extendqisi2
-	cmp	r3, #102
-	bhi	.L82
-	ldrb	r3, [fp, #-16]	@ zero_extendqisi2
-	sub	r3, r3, #87
-	str	r3, [fp, #-20]
-	b	.L81
-.L82:
-	ldrb	r3, [fp, #-16]	@ zero_extendqisi2
-	cmp	r3, #64
-	bls	.L85
-	ldrb	r3, [fp, #-16]	@ zero_extendqisi2
-	cmp	r3, #70
-	bhi	.L85
-	ldrb	r3, [fp, #-16]	@ zero_extendqisi2
-	sub	r3, r3, #55
-	str	r3, [fp, #-20]
-	b	.L81
-.L85:
-	mvn	r3, #0
-	str	r3, [fp, #-20]
-.L81:
-	ldr	r3, [fp, #-20]
-	mov	r0, r3
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-	.size	bwa2d, .-bwa2d
-	.align	2
-	.global	bwa2i
-	.type	bwa2i, %function
-bwa2i:
-	@ args = 0, pretend = 0, frame = 28
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #28
-	str	r1, [fp, #-32]
-	str	r2, [fp, #-36]
-	str	r3, [fp, #-40]
-	mov	r3, r0
-	strb	r3, [fp, #-28]
-	ldr	r3, [fp, #-32]
-	ldr	r3, [r3, #0]
-	str	r3, [fp, #-16]
-	mov	r3, #0
-	str	r3, [fp, #-24]
-	b	.L90
-.L91:
-	ldr	r2, [fp, #-20]
-	ldr	r3, [fp, #-36]
-	cmp	r2, r3
-	bgt	.L92
-	ldr	r2, [fp, #-24]
-	ldr	r3, [fp, #-36]
-	mul	r2, r3, r2
-	ldr	r3, [fp, #-20]
-	add	r3, r2, r3
-	str	r3, [fp, #-24]
-	ldr	r3, [fp, #-16]
-	ldrb	r3, [r3, #0]
-	strb	r3, [fp, #-28]
-	ldr	r3, [fp, #-16]
-	add	r3, r3, #1
-	str	r3, [fp, #-16]
-.L90:
-	ldrb	r3, [fp, #-28]	@ zero_extendqisi2
-	mov	r0, r3
-	bl	bwa2d(PLT)
-	mov	r3, r0
-	str	r3, [fp, #-20]
-	ldr	r3, [fp, #-20]
-	cmp	r3, #0
-	bge	.L91
-.L92:
-	ldr	r2, [fp, #-32]
-	ldr	r3, [fp, #-16]
-	str	r3, [r2, #0]
-	ldr	r2, [fp, #-40]
-	ldr	r3, [fp, #-24]
-	str	r3, [r2, #0]
-	ldrb	r3, [fp, #-28]	@ zero_extendqisi2
-	mov	r0, r3
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-	.size	bwa2i, .-bwa2i
-	.global	__udivsi3
-	.global	__umodsi3
-	.align	2
-	.global	bwui2a
-	.type	bwui2a, %function
-bwui2a:
-	@ args = 0, pretend = 0, frame = 28
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #28
-	str	r0, [fp, #-28]
-	str	r1, [fp, #-32]
-	str	r2, [fp, #-36]
-	mov	r3, #0
-	str	r3, [fp, #-24]
-	mov	r3, #1
-	str	r3, [fp, #-16]
-	b	.L96
-.L97:
-	ldr	r3, [fp, #-16]
-	ldr	r2, [fp, #-32]
-	mul	r3, r2, r3
-	str	r3, [fp, #-16]
-.L96:
-	ldr	r0, [fp, #-28]
-	ldr	r1, [fp, #-16]
-	bl	__udivsi3(PLT)
-	mov	r3, r0
-	mov	r2, r3
-	ldr	r3, [fp, #-32]
-	cmp	r2, r3
-	bcs	.L97
-	b	.L109
-.L100:
-	ldr	r0, [fp, #-28]
-	ldr	r1, [fp, #-16]
-	bl	__udivsi3(PLT)
-	mov	r3, r0
-	str	r3, [fp, #-20]
-	ldr	r3, [fp, #-28]
-	mov	r0, r3
-	ldr	r1, [fp, #-16]
-	bl	__umodsi3(PLT)
-	mov	r3, r0
-	str	r3, [fp, #-28]
-	ldr	r0, [fp, #-16]
-	ldr	r1, [fp, #-32]
-	bl	__udivsi3(PLT)
-	mov	r3, r0
-	str	r3, [fp, #-16]
-	ldr	r3, [fp, #-24]
-	cmp	r3, #0
-	bne	.L101
-	ldr	r3, [fp, #-20]
-	cmp	r3, #0
-	bgt	.L101
-	ldr	r3, [fp, #-16]
-	cmp	r3, #0
-	bne	.L99
-.L101:
-	ldr	r3, [fp, #-20]
-	cmp	r3, #9
-	bgt	.L104
-	mov	r1, #48
-	str	r1, [fp, #-40]
-	b	.L106
-.L104:
-	mov	r3, #87
-	str	r3, [fp, #-40]
-.L106:
-	ldr	r3, [fp, #-20]
-	and	r3, r3, #255
-	ldr	r1, [fp, #-40]
-	mov	r2, r1
-	add	r3, r2, r3
-	and	r3, r3, #255
-	and	r3, r3, #255
-	ldr	r2, [fp, #-36]
-	strb	r3, [r2, #0]
-	ldr	r3, [fp, #-36]
-	add	r3, r3, #1
-	str	r3, [fp, #-36]
-	ldr	r3, [fp, #-24]
-	add	r3, r3, #1
-	str	r3, [fp, #-24]
-.L99:
-.L109:
-	ldr	r3, [fp, #-16]
-	cmp	r3, #0
-	bne	.L100
-	ldr	r3, [fp, #-36]
-	mov	r2, #0
-	strb	r2, [r3, #0]
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-	.size	bwui2a, .-bwui2a
-	.align	2
-	.global	bwi2a
-	.type	bwi2a, %function
-bwi2a:
-	@ args = 0, pretend = 0, frame = 8
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #8
-	str	r0, [fp, #-16]
-	str	r1, [fp, #-20]
-	ldr	r3, [fp, #-16]
-	cmp	r3, #0
-	bge	.L111
-	ldr	r3, [fp, #-16]
-	rsb	r3, r3, #0
-	str	r3, [fp, #-16]
-	ldr	r2, [fp, #-20]
-	mov	r3, #45
-	strb	r3, [r2, #0]
-	ldr	r3, [fp, #-20]
-	add	r3, r3, #1
-	str	r3, [fp, #-20]
-.L111:
-	ldr	r3, [fp, #-16]
-	mov	r0, r3
-	mov	r1, #10
-	ldr	r2, [fp, #-20]
-	bl	bwui2a(PLT)
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-	.size	bwi2a, .-bwi2a
-	.align	2
-	.global	bwformat
-	.type	bwformat, %function
-bwformat:
-	@ args = 0, pretend = 0, frame = 40
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #40
-	str	r0, [fp, #-36]
-	str	r1, [fp, #-40]
-	str	r2, [fp, #-44]
-	b	.L133
-.L116:
-	ldrb	r3, [fp, #-14]	@ zero_extendqisi2
-	cmp	r3, #37
-	beq	.L117
-	ldrb	r3, [fp, #-14]	@ zero_extendqisi2
-	ldr	r0, [fp, #-36]
-	mov	r1, r3
-	bl	bwputc(PLT)
-	b	.L115
-.L117:
-	mov	r3, #0
-	strb	r3, [fp, #-13]
-	mov	r3, #0
-	str	r3, [fp, #-32]
-	ldr	r2, [fp, #-40]
-	ldrb	r3, [r2, #0]
-	strb	r3, [fp, #-14]
-	add	r3, r2, #1
-	str	r3, [fp, #-40]
-	ldrb	r3, [fp, #-14]	@ zero_extendqisi2
-	str	r3, [fp, #-52]
-	ldr	r3, [fp, #-52]
-	cmp	r3, #48
-	beq	.L120
-	ldr	r3, [fp, #-52]
-	cmp	r3, #48
-	blt	.L119
-	ldr	r3, [fp, #-52]
-	cmp	r3, #57
-	bgt	.L119
-	b	.L121
-.L120:
-	mov	r3, #1
-	strb	r3, [fp, #-13]
-	ldr	r2, [fp, #-40]
-	ldrb	r3, [r2, #0]
-	strb	r3, [fp, #-14]
-	add	r3, r2, #1
-	str	r3, [fp, #-40]
-	b	.L119
-.L121:
-	ldrb	r3, [fp, #-14]	@ zero_extendqisi2
-	sub	r2, fp, #40
-	sub	ip, fp, #32
-	mov	r0, r3
-	mov	r1, r2
-	mov	r2, #10
-	mov	r3, ip
-	bl	bwa2i(PLT)
-	mov	r3, r0
-	strb	r3, [fp, #-14]
-.L119:
-	ldrb	r3, [fp, #-14]	@ zero_extendqisi2
-	str	r3, [fp, #-48]
-	ldr	r3, [fp, #-48]
-	cmp	r3, #115
-	beq	.L126
-	ldr	r3, [fp, #-48]
-	cmp	r3, #115
-	bgt	.L129
-	ldr	r3, [fp, #-48]
-	cmp	r3, #99
-	beq	.L124
-	ldr	r3, [fp, #-48]
-	cmp	r3, #99
-	bgt	.L130
-	ldr	r3, [fp, #-48]
-	cmp	r3, #0
-	beq	.L132
-	ldr	r3, [fp, #-48]
-	cmp	r3, #37
-	beq	.L123
-	b	.L115
-.L130:
-	ldr	r3, [fp, #-48]
-	cmp	r3, #100
-	beq	.L125
-	b	.L115
-.L129:
-	ldr	r3, [fp, #-48]
-	cmp	r3, #117
-	beq	.L127
-	ldr	r3, [fp, #-48]
-	cmp	r3, #120
-	beq	.L128
-	b	.L115
-.L124:
-	ldr	r3, [fp, #-44]
-	add	r3, r3, #4
-	str	r3, [fp, #-44]
-	ldr	r3, [fp, #-44]
-	sub	r3, r3, #4
-	ldrb	r3, [r3, #0]	@ zero_extendqisi2
-	ldr	r0, [fp, #-36]
-	mov	r1, r3
-	bl	bwputc(PLT)
-	b	.L115
-.L126:
-	ldr	r2, [fp, #-32]
-	ldr	r3, [fp, #-44]
-	add	r3, r3, #4
-	str	r3, [fp, #-44]
-	ldr	r3, [fp, #-44]
-	sub	r3, r3, #4
-	ldr	r3, [r3, #0]
-	ldr	r0, [fp, #-36]
-	mov	r1, r2
-	mov	r2, #0
-	bl	bwputw(PLT)
-	b	.L115
-.L127:
-	ldr	r3, [fp, #-44]
-	add	r3, r3, #4
-	str	r3, [fp, #-44]
-	ldr	r3, [fp, #-44]
-	sub	r3, r3, #4
-	ldr	r3, [r3, #0]
-	sub	r2, fp, #26
-	mov	r0, r3
-	mov	r1, #10
-	bl	bwui2a(PLT)
-	ldr	r3, [fp, #-32]
-	ldrb	r2, [fp, #-13]	@ zero_extendqisi2
-	sub	ip, fp, #26
-	ldr	r0, [fp, #-36]
-	mov	r1, r3
-	mov	r3, ip
-	bl	bwputw(PLT)
-	b	.L115
-.L125:
-	ldr	r3, [fp, #-44]
-	add	r3, r3, #4
-	str	r3, [fp, #-44]
-	ldr	r3, [fp, #-44]
-	sub	r3, r3, #4
-	ldr	r3, [r3, #0]
-	sub	r2, fp, #26
-	mov	r0, r3
-	mov	r1, r2
-	bl	bwi2a(PLT)
-	ldr	r3, [fp, #-32]
-	ldrb	r2, [fp, #-13]	@ zero_extendqisi2
-	sub	ip, fp, #26
-	ldr	r0, [fp, #-36]
-	mov	r1, r3
-	mov	r3, ip
-	bl	bwputw(PLT)
-	b	.L115
-.L128:
-	ldr	r3, [fp, #-44]
-	add	r3, r3, #4
-	str	r3, [fp, #-44]
-	ldr	r3, [fp, #-44]
-	sub	r3, r3, #4
-	ldr	r3, [r3, #0]
-	sub	r2, fp, #26
-	mov	r0, r3
-	mov	r1, #16
-	bl	bwui2a(PLT)
-	ldr	r3, [fp, #-32]
-	ldrb	r2, [fp, #-13]	@ zero_extendqisi2
-	sub	ip, fp, #26
-	ldr	r0, [fp, #-36]
-	mov	r1, r3
-	mov	r3, ip
-	bl	bwputw(PLT)
-	b	.L115
-.L123:
-	ldrb	r3, [fp, #-14]	@ zero_extendqisi2
-	ldr	r0, [fp, #-36]
-	mov	r1, r3
-	bl	bwputc(PLT)
-.L115:
-.L133:
-	ldr	r1, [fp, #-40]
-	ldrb	r3, [r1, #0]
-	strb	r3, [fp, #-14]
-	ldrb	r3, [fp, #-14]	@ zero_extendqisi2
-	cmp	r3, #0
-	moveq	r3, #0
-	movne	r3, #1
-	and	r2, r3, #255
-	add	r3, r1, #1
-	str	r3, [fp, #-40]
-	cmp	r2, #0
-	bne	.L116
-.L132:
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-	.size	bwformat, .-bwformat
-	.align	2
-	.global	bwprintf
-	.type	bwprintf, %function
-bwprintf:
-	@ args = 4, pretend = 12, frame = 8
-	@ frame_needed = 1, uses_anonymous_args = 1
-	mov	ip, sp
-	stmfd	sp!, {r1, r2, r3}
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #16
-	sub	sp, sp, #8
-	str	r0, [fp, #-20]
-	add	r3, fp, #8
-	str	r3, [fp, #-16]
-	ldr	r0, [fp, #-20]
-	ldr	r1, [fp, #4]
-	ldr	r2, [fp, #-16]
-	bl	bwformat(PLT)
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-	.size	bwprintf, .-bwprintf
-	.ident	"GCC: (GNU) 4.0.2"
diff --git a/lib/context-switch.o b/lib/context-switch.o
deleted file mode 100644
index 7d722f964fe7de0400378a93c0aa1095616d2460..0000000000000000000000000000000000000000
Binary files a/lib/context-switch.o and /dev/null differ
diff --git a/lib/hash-table.c b/lib/hash-table.c
new file mode 100644
index 0000000000000000000000000000000000000000..3079a89c553a0849ec60a03611a0413002673c95
--- /dev/null
+++ b/lib/hash-table.c
@@ -0,0 +1,63 @@
+#include <error.h>
+#include <hash-table.h>
+
+int Alpha2Num(char a){
+  if((a<='Z' && a>='A')) return a-'A';
+  if((a<='z' && a>='a')) return ((a-'a')+26);
+  return ILLEGAL_NAME;
+}
+
+
+int Hash(HT* Table,char* Str, int Len,int *R1,int *R2){
+  int i = 0;
+  int h1 = 0;
+  int h2 = 0;
+  int tempNum;
+  int MagicNumber = Table->size;
+  for(;i<Len;i++){
+    h1 *= 52;
+    h2 *= 52;
+    tempNum = Alpha2Num(Str[i]);
+    if(tempNum == ILLEGAL_NAME) return tempNum;
+    h1 += tempNum;
+    h2 += tempNum;
+    h2 /= MagicNumber;
+    h1 %= MagicNumber;
+    h2 %= MagicNumber;
+  }
+  *R1 = h1;
+  *R2 = h2;
+}
+    
+int InsertTo(HT* Table, int Tid, char* Str, int Len){
+  int h1,h2;
+  Hash(Table,Str,Len,&h1,&h2);
+  if(Table->TidSequence[h1]!=-1 && Table->TidSequence[h1+h2]!=-1)return HT_NOSLOT;
+  if(Table->TidSequence[h1] == -1){
+    Table->TidSequence[h1] = Tid;
+    int i = 0;
+    for(;i<=Len;i++){
+      Table->NameSequence[h1][i] = Str[i];
+    }
+  }else if(Table->TidSequence[h1+h2] == -1){
+    Table->TidSequence[h1+h2] = Tid;
+    int i = 0;
+    for(;i<Len;i++){
+      Table->NameSequence[h1+h2][i] = Str[i];
+    }
+  }
+  return 0;
+}
+
+int Lookup(HT* Table,char* Str, int Len){
+  int h1,h2;
+  Hash(Table,Str,Len,&h1,&h2);
+  int result = stringCompare(Table->NameSequence[h1],Str);
+  if(result==0){
+    return stringCompare(Table->TidSequence[h1]);
+  }else{
+    result = stringCompare(Table->NameSequence[h1+h2],Str);
+    if(result == 0) return stringCompare(Table->TidSequence[h1+h2]);
+  }
+  return -1;
+}
diff --git a/lib/k1.o b/lib/k1.o
deleted file mode 100644
index dbb55402bf59209c965df23008ec5bc4354b104c..0000000000000000000000000000000000000000
Binary files a/lib/k1.o and /dev/null differ
diff --git a/lib/k1.s b/lib/k1.s
deleted file mode 100644
index d9e5c3529a32305157a54f2075081b0c90f5710d..0000000000000000000000000000000000000000
--- a/lib/k1.s
+++ /dev/null
@@ -1,146 +0,0 @@
-	.file	"k1.c"
-	.section	.rodata
-	.align	2
-.LC0:
-	.ascii	"My TaskID: <%d> and My ParentID: <%d>\012\015\000"
-	.text
-	.align	2
-	.global	someK1Fn
-	.type	someK1Fn, %function
-someK1Fn:
-	@ args = 0, pretend = 0, frame = 0
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {r4, sl, fp, ip, lr, pc}
-	sub	fp, ip, #4
-	ldr	sl, .L4
-.L3:
-	add	sl, pc, sl
-	bl	MyTid(PLT)
-	mov	r4, r0
-	bl	MyParentTid(PLT)
-	mov	ip, r0
-	mov	r0, #1
-	ldr	r3, .L4+4
-	add	r3, sl, r3
-	mov	r1, r3
-	mov	r2, r4
-	mov	r3, ip
-	bl	bwprintf(PLT)
-	bl	Pass(PLT)
-	bl	MyTid(PLT)
-	mov	r4, r0
-	bl	MyParentTid(PLT)
-	mov	ip, r0
-	mov	r0, #1
-	ldr	r3, .L4+4
-	add	r3, sl, r3
-	mov	r1, r3
-	mov	r2, r4
-	mov	r3, ip
-	bl	bwprintf(PLT)
-	bl	Exit(PLT)
-	ldmfd	sp, {r4, sl, fp, sp, pc}
-.L5:
-	.align	2
-.L4:
-	.word	_GLOBAL_OFFSET_TABLE_-(.L3+8)
-	.word	.LC0(GOTOFF)
-	.size	someK1Fn, .-someK1Fn
-	.section	.rodata
-	.align	2
-.LC1:
-	.ascii	"Created: <%d>\012\015\000"
-	.align	2
-.LC2:
-	.ascii	"FirstUserTask: exiting\012\015\000"
-	.text
-	.align	2
-	.global	firstUserTaskChildren
-	.type	firstUserTaskChildren, %function
-firstUserTaskChildren:
-	@ args = 0, pretend = 0, frame = 36
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {sl, fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #36
-	ldr	sl, .L9
-.L8:
-	add	sl, pc, sl
-	mov	r3, #1
-	str	r3, [fp, #-36]
-	ldr	r3, .L9+4
-	ldr	r3, [sl, r3]
-	str	r3, [fp, #-32]
-	mov	r3, #0
-	str	r3, [fp, #-28]
-	mov	r3, #0
-	str	r3, [fp, #-24]
-	sub	ip, fp, #52
-	sub	r3, fp, #36
-	ldmia	r3, {r0, r1, r2, r3}
-	stmia	ip, {r0, r1, r2, r3}
-	mov	r3, #5
-	str	r3, [fp, #-52]
-	sub	r3, fp, #36
-	mov	r0, r3
-	bl	Create(PLT)
-	mov	r3, r0
-	str	r3, [fp, #-20]
-	mov	r0, #1
-	ldr	r3, .L9+8
-	add	r3, sl, r3
-	mov	r1, r3
-	ldr	r2, [fp, #-20]
-	bl	bwprintf(PLT)
-	sub	r3, fp, #36
-	mov	r0, r3
-	bl	Create(PLT)
-	mov	r3, r0
-	str	r3, [fp, #-20]
-	mov	r0, #1
-	ldr	r3, .L9+8
-	add	r3, sl, r3
-	mov	r1, r3
-	ldr	r2, [fp, #-20]
-	bl	bwprintf(PLT)
-	sub	r3, fp, #52
-	mov	r0, r3
-	bl	Create(PLT)
-	mov	r3, r0
-	str	r3, [fp, #-20]
-	mov	r0, #1
-	ldr	r3, .L9+8
-	add	r3, sl, r3
-	mov	r1, r3
-	ldr	r2, [fp, #-20]
-	bl	bwprintf(PLT)
-	sub	r3, fp, #52
-	mov	r0, r3
-	bl	Create(PLT)
-	mov	r3, r0
-	str	r3, [fp, #-20]
-	mov	r0, #1
-	ldr	r3, .L9+8
-	add	r3, sl, r3
-	mov	r1, r3
-	ldr	r2, [fp, #-20]
-	bl	bwprintf(PLT)
-	mov	r0, #1
-	ldr	r3, .L9+12
-	add	r3, sl, r3
-	mov	r1, r3
-	bl	bwprintf(PLT)
-	bl	Exit(PLT)
-	sub	sp, fp, #16
-	ldmfd	sp, {sl, fp, sp, pc}
-.L10:
-	.align	2
-.L9:
-	.word	_GLOBAL_OFFSET_TABLE_-(.L8+8)
-	.word	someK1Fn(GOT)
-	.word	.LC1(GOTOFF)
-	.word	.LC2(GOTOFF)
-	.size	firstUserTaskChildren, .-firstUserTaskChildren
-	.ident	"GCC: (GNU) 4.0.2"
diff --git a/lib/k2.c b/lib/k2.c
new file mode 100644
index 0000000000000000000000000000000000000000..6341e1755ddaea615ef215f96808bb2c276c0642
--- /dev/null
+++ b/lib/k2.c
@@ -0,0 +1,59 @@
+#include <bwio.h>
+#include <hash-table.h>
+#include <types.h>
+#include <syscall.h>
+
+void someK1Fn() {
+  //	bwprintf(COM2, "someK1Fn: just in someK1Fn\n\r");
+  bwprintf(COM2, "My TaskID: <%d> and My ParentID: <%d>\n\r", MyTid(), MyParentTid());
+  //	bwprintf(COM2, "someK1Fn: before calling Pass\n\r");
+  Pass();
+  bwprintf(COM2, "My TaskID: <%d> and My ParentID: <%d>\n\r", MyTid(), MyParentTid());
+  Exit();
+}
+
+void NameServer(){
+  int TIDSeq[HASH_SIZE];
+  char Names[HASH_SIZE][NAME_LENGTH_MAX+1];
+
+  // initialize Names
+  int i = 0;
+  for(;i<257;i++){
+    Names[i][NAME_LENGTH_MAX] = 0;
+  }
+  
+  HT HashTable;
+  HashTable.TidSequence = TIDSeq;
+  HashTable.NameSequence = Names;
+  HashTable.size = HASH_SIZE;
+
+  Buffer SendQ;
+  int storage[MAX_NUM_BUFFER];
+  SendQ.Storage = (void *)(storage);
+  SendQ.size = MAX_NUM_BUFFER;
+  SendQ.Head = 0;
+  SendQ.Tail = 0;
+  SendQ.Length = 0;
+
+  // some sort of while loop to receive and reply
+  
+}
+
+void firstUserTaskChildren() {
+  int TaskID;
+  AP Args1, Args5;
+  Args1.arg0 = (void *)(Prio1);
+  Args1.arg1 = (void *)(&NameServer);
+  Args1.arg2 = 0;
+  Args1.arg3 = 0;
+
+  int NameServerID = Create(&Args1);
+  Args1.arg0 = (void *)(NameServerID);
+  RecordNameServer(&Args1);
+  
+  Args5 = Args1;
+  Args5.arg0 = (void *)(Prio5);
+
+  bwprintf(COM2, "FirstUserTask: exiting\n\r");
+  Exit();
+}
diff --git a/lib/kernel.o b/lib/kernel.o
deleted file mode 100644
index 4b067299b24b6845858cb76496708c9001906944..0000000000000000000000000000000000000000
Binary files a/lib/kernel.o and /dev/null differ
diff --git a/lib/kernel.s b/lib/kernel.s
deleted file mode 100644
index 8db1c88101f9abf31be2a0944591978c3d3bba43..0000000000000000000000000000000000000000
--- a/lib/kernel.s
+++ /dev/null
@@ -1,203 +0,0 @@
-	.file	"kernel.c"
-	.text
-	.align	2
-	.global	kernelInit
-	.type	kernelInit, %function
-kernelInit:
-	@ args = 0, pretend = 0, frame = 20
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #20
-	str	r0, [fp, #-32]
-	mov	r3, #-2147483648
-	str	r3, [fp, #-16]
-	mov	r3, #0
-	str	r3, [fp, #-28]
-	b	.L2
-.L3:
-	ldr	r3, [fp, #-32]
-	add	r1, r3, #100
-	ldr	r2, [fp, #-28]
-	mov	r3, r2
-	mov	r3, r3, asl #2
-	add	r3, r3, r2
-	mov	r3, r3, asl #1
-	add	r3, r3, r2
-	mov	r3, r3, asl #2
-	add	r3, r1, r3
-	str	r3, [fp, #-24]
-	ldr	r2, [fp, #-28]
-	ldr	r3, [fp, #-16]
-	orr	r2, r2, r3
-	ldr	r3, [fp, #-24]
-	str	r2, [r3, #20]
-	ldr	r2, [fp, #-24]
-	mov	r3, #0
-	str	r3, [r2, #24]
-	ldr	r2, [fp, #-24]
-	mov	r3, #3
-	str	r3, [r2, #28]
-	ldr	r2, [fp, #-24]
-	mov	r3, #0
-	str	r3, [r2, #32]
-	ldr	r3, [fp, #-28]
-	cmp	r3, #59
-	bne	.L4
-	ldr	r2, [fp, #-24]
-	mov	r3, #0
-	str	r3, [r2, #36]
-	b	.L6
-.L4:
-	ldr	r3, [fp, #-32]
-	add	r1, r3, #100
-	ldr	r2, [fp, #-28]
-	mov	r3, r2
-	mov	r3, r3, asl #2
-	add	r3, r3, r2
-	mov	r3, r3, asl #1
-	add	r3, r3, r2
-	mov	r3, r3, asl #2
-	add	r3, r1, r3
-	add	r2, r3, #44
-	ldr	r3, [fp, #-24]
-	str	r2, [r3, #36]
-.L6:
-	ldr	r2, [fp, #-24]
-	mov	r3, #0
-	str	r3, [r2, #40]
-	ldr	r3, [fp, #-28]
-	mov	r3, r3, asl #19
-	rsb	r3, r3, #31457280
-	mov	r2, r3
-	ldr	r3, [fp, #-24]
-	str	r2, [r3, #0]
-	ldr	r2, [fp, #-24]
-	mov	r3, #22
-	str	r3, [r2, #12]
-	ldr	r2, [fp, #-24]
-	mov	r3, #0
-	str	r3, [r2, #4]
-	ldr	r3, [fp, #-28]
-	add	r3, r3, #1
-	str	r3, [fp, #-28]
-.L2:
-	ldr	r3, [fp, #-28]
-	cmp	r3, #59
-	ble	.L3
-	mov	r3, #0
-	str	r3, [fp, #-28]
-	b	.L8
-.L9:
-	ldr	r3, [fp, #-32]
-	add	r1, r3, #4
-	ldr	r2, [fp, #-28]
-	mov	r3, r2
-	mov	r3, r3, asl #1
-	add	r3, r3, r2
-	mov	r3, r3, asl #2
-	add	r3, r1, r3
-	str	r3, [fp, #-20]
-	ldr	r2, [fp, #-20]
-	mov	r3, #0
-	str	r3, [r2, #0]
-	ldr	r2, [fp, #-20]
-	mov	r3, #0
-	str	r3, [r2, #4]
-	ldr	r2, [fp, #-20]
-	mov	r3, #0
-	str	r3, [r2, #8]
-	ldr	r3, [fp, #-28]
-	add	r3, r3, #1
-	str	r3, [fp, #-28]
-.L8:
-	ldr	r3, [fp, #-28]
-	cmp	r3, #7
-	ble	.L9
-	ldr	r3, [fp, #-32]
-	add	r2, r3, #100
-	ldr	r3, [fp, #-32]
-	str	r2, [r3, #2740]
-	ldr	r3, [fp, #-32]
-	add	r3, r3, #100
-	add	r3, r3, #2592
-	add	r3, r3, #4
-	ldr	r2, [fp, #-32]
-	str	r3, [r2, #2744]
-	ldr	r2, [fp, #-32]
-	mov	r3, #60
-	str	r3, [r2, #2748]
-	ldr	r2, [fp, #-32]
-	mov	r3, #0
-	str	r3, [r2, #0]
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-	.size	kernelInit, .-kernelInit
-	.align	2
-	.global	InitSwi
-	.type	InitSwi, %function
-InitSwi:
-	@ args = 0, pretend = 0, frame = 0
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	mov r4, #0x28
-	ldr r5, =kerent
-	add r5, r5, #0x218000
-	str r5, [r4]
-	
-	ldmfd	sp, {fp, sp, pc}
-	.size	InitSwi, .-InitSwi
-	.align	2
-	.global	GetFreeTD
-	.type	GetFreeTD, %function
-GetFreeTD:
-	@ args = 0, pretend = 0, frame = 16
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #16
-	str	r0, [fp, #-24]
-	mov	r3, #0
-	str	r3, [fp, #-16]
-	b	.L15
-.L16:
-	ldr	r3, [fp, #-24]
-	add	r1, r3, #100
-	ldr	r2, [fp, #-16]
-	mov	r3, r2
-	mov	r3, r3, asl #2
-	add	r3, r3, r2
-	mov	r3, r3, asl #1
-	add	r3, r3, r2
-	mov	r3, r3, asl #2
-	add	r3, r1, r3
-	str	r3, [fp, #-20]
-	ldr	r0, [fp, #-20]
-	bl	GetAvailability(PLT)
-	mov	r3, r0
-	cmp	r3, #0
-	beq	.L17
-	ldr	r3, [fp, #-20]
-	str	r3, [fp, #-28]
-	b	.L19
-.L17:
-	ldr	r3, [fp, #-16]
-	add	r3, r3, #1
-	str	r3, [fp, #-16]
-.L15:
-	ldr	r3, [fp, #-16]
-	cmp	r3, #59
-	ble	.L16
-	mov	r3, #0
-	str	r3, [fp, #-28]
-.L19:
-	ldr	r3, [fp, #-28]
-	mov	r0, r3
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-	.size	GetFreeTD, .-GetFreeTD
-	.ident	"GCC: (GNU) 4.0.2"
diff --git a/lib/libbwio.a b/lib/libbwio.a
deleted file mode 100644
index a0c759b065f76cb6d85fef3deb73036519f5f6bb..0000000000000000000000000000000000000000
Binary files a/lib/libbwio.a and /dev/null differ
diff --git a/lib/libbwio.q b/lib/libbwio.q
deleted file mode 100644
index 802353ed9b4fbef2e450798d07052f5c106ef80a..0000000000000000000000000000000000000000
Binary files a/lib/libbwio.q and /dev/null differ
diff --git a/lib/libcs.a b/lib/libcs.a
deleted file mode 100644
index 19f0c84448f219cfeb7075ae7f90775f81388b12..0000000000000000000000000000000000000000
Binary files a/lib/libcs.a and /dev/null differ
diff --git a/lib/libk1.a b/lib/libk1.a
deleted file mode 100644
index 95fffe703275d6f3044d3aab349e5f5464100c1f..0000000000000000000000000000000000000000
Binary files a/lib/libk1.a and /dev/null differ
diff --git a/lib/libkernel.a b/lib/libkernel.a
deleted file mode 100644
index cdbc12c8b7e3d87cb7c21f34099c7570026b60dc..0000000000000000000000000000000000000000
Binary files a/lib/libkernel.a and /dev/null differ
diff --git a/lib/libpq.a b/lib/libpq.a
deleted file mode 100644
index 466fe5c505bfb0d7e20a27541ff529d35e708a95..0000000000000000000000000000000000000000
Binary files a/lib/libpq.a and /dev/null differ
diff --git a/lib/libsche.a b/lib/libsche.a
deleted file mode 100644
index d981ad38d65759f9e7af3ebc93e80286a23914cd..0000000000000000000000000000000000000000
Binary files a/lib/libsche.a and /dev/null differ
diff --git a/lib/libsys.a b/lib/libsys.a
deleted file mode 100644
index 8404e696a06b6677eb0ecde0b4b15b5a1ad3414c..0000000000000000000000000000000000000000
Binary files a/lib/libsys.a and /dev/null differ
diff --git a/lib/libsysh.a b/lib/libsysh.a
deleted file mode 100644
index 9e159371334e0106ffb57fd329f6ebefb9626758..0000000000000000000000000000000000000000
Binary files a/lib/libsysh.a and /dev/null differ
diff --git a/lib/libtd.a b/lib/libtd.a
deleted file mode 100644
index 2fa9b82caa0d3d527e96bd81b79a70ac55b2f234..0000000000000000000000000000000000000000
Binary files a/lib/libtd.a and /dev/null differ
diff --git a/lib/nameserver.c b/lib/nameserver.c
index 32d0300653e51df6b72707a4d441807dfea7353f..c1b5e0866290048e63fd71066b5ed55f212a8e68 100644
--- a/lib/nameserver.c
+++ b/lib/nameserver.c
@@ -1,12 +1,18 @@
 #include <nameserver.h>
 #include <tools.h>
 
- 
+
+int ActualWhoIS(AP* Args){
+  asm volatile ("swi 9\n\t");
+  register int r0 asm ("r0");
+  int R = r0;
+  return R;
+}
+
 int WhoIs(char* Name) {
     NSReqMsg SendMsg, ReplyMsg; 
     int Status;
     AP Args;
-    register int r0 asm ("r0");
 
     SendMsg.MsgType = WhoIs; 
     stringCopy(SendMsg.Msg, Name, NS_MESSAGE_MAX_LENGTH);
@@ -16,20 +22,23 @@ int WhoIs(char* Name) {
     Args.arg2 = ReplyMsg;
     Args.arg3 = sizeof(NSMsg);
 
-    asm volatile ("swi 5\n\t");
-
-    Status = r0;
+    Status = ActualWhoIS(&Args)
 
     if (Status == sizeof(NSMsg)) return ReplyMsg.TaskID; // TODO FIXME TODO
     else return NAMESERVER_TID_INVALID;
 }
 
+int ActualRegAS(AP* Args){
+  asm volatile ("swi 10\n\t");
+  register int r0 asm ("r0");
+  int R = r0;
+  return R;
+}
 
 int RegisterAs (char* Name) {
     NSReqMsg SendMsg, ReplyMsg; 
     int Status;
     AP Args;
-    register int r0 asm ("r0");
 
     SendMsg.MsgType = RegisterAs; 
     stringCopy(SendMsg.Msg, Name, NS_MESSAGE_MAX_LENGTH);
@@ -39,10 +48,8 @@ int RegisterAs (char* Name) {
     Args.arg2 = ReplyMsg;
     Args.arg3 = sizeof(NSMsg);
 
-    asm volatile ("swi 5\n\t");
-    
-    Status = r0;
+    Status = ActualRegAS(&Args);
 
     if (Status == sizeof(NSMsg)) return SUCCESS;
     else return NAMESERVER_TID_INVALID;
-}
\ No newline at end of file
+}
diff --git a/lib/priority-q.o b/lib/priority-q.o
deleted file mode 100644
index bf77eda69c427c5efeaec293f986bb378dcccea6..0000000000000000000000000000000000000000
Binary files a/lib/priority-q.o and /dev/null differ
diff --git a/lib/priority-q.s b/lib/priority-q.s
deleted file mode 100644
index 93022a668d400dc4d6a070a1dd8d0a325c03e6e0..0000000000000000000000000000000000000000
--- a/lib/priority-q.s
+++ /dev/null
@@ -1,205 +0,0 @@
-	.file	"priority-q.c"
-	.text
-	.align	2
-	.global	ASCII2NUM
-	.type	ASCII2NUM, %function
-ASCII2NUM:
-	@ args = 0, pretend = 0, frame = 8
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #8
-	mov	r3, r0
-	strb	r3, [fp, #-16]
-	ldrb	r3, [fp, #-16]	@ zero_extendqisi2
-	cmp	r3, #47
-	bls	.L2
-	ldrb	r3, [fp, #-16]	@ zero_extendqisi2
-	cmp	r3, #57
-	bhi	.L2
-	ldrb	r3, [fp, #-16]	@ zero_extendqisi2
-	sub	r3, r3, #48
-	str	r3, [fp, #-20]
-	b	.L5
-.L2:
-	ldrb	r3, [fp, #-16]	@ zero_extendqisi2
-	cmp	r3, #96
-	bls	.L6
-	ldrb	r3, [fp, #-16]	@ zero_extendqisi2
-	cmp	r3, #102
-	bhi	.L6
-	ldrb	r3, [fp, #-16]	@ zero_extendqisi2
-	sub	r3, r3, #87
-	str	r3, [fp, #-20]
-	b	.L5
-.L6:
-	ldrb	r3, [fp, #-16]	@ zero_extendqisi2
-	cmp	r3, #64
-	bls	.L9
-	ldrb	r3, [fp, #-16]	@ zero_extendqisi2
-	cmp	r3, #70
-	bhi	.L9
-	ldrb	r3, [fp, #-16]	@ zero_extendqisi2
-	sub	r3, r3, #55
-	str	r3, [fp, #-20]
-	b	.L5
-.L9:
-	mvn	r3, #0
-	str	r3, [fp, #-20]
-.L5:
-	ldr	r3, [fp, #-20]
-	mov	r0, r3
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-	.size	ASCII2NUM, .-ASCII2NUM
-	.align	2
-	.global	TDPQReady
-	.type	TDPQReady, %function
-TDPQReady:
-	@ args = 0, pretend = 0, frame = 8
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #8
-	str	r0, [fp, #-20]
-	ldr	r3, [fp, #-20]
-	cmp	r3, #0
-	moveq	r3, #0
-	movne	r3, #1
-	str	r3, [fp, #-16]
-	ldr	r3, [fp, #-16]
-	mov	r0, r3
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-	.size	TDPQReady, .-TDPQReady
-	.align	2
-	.global	PushToTDPQ
-	.type	PushToTDPQ, %function
-PushToTDPQ:
-	@ args = 0, pretend = 0, frame = 12
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #12
-	str	r0, [fp, #-16]
-	str	r1, [fp, #-20]
-	ldr	r0, [fp, #-16]
-	bl	TDPQReady(PLT)
-	mov	r3, r0
-	cmp	r3, #0
-	beq	.L16
-	ldr	r3, [fp, #-16]
-	ldr	r3, [r3, #0]
-	cmp	r3, #0
-	bne	.L18
-	ldr	r2, [fp, #-16]
-	ldr	r3, [fp, #-20]
-	str	r3, [r2, #0]
-	ldr	r2, [fp, #-16]
-	ldr	r3, [fp, #-20]
-	str	r3, [r2, #4]
-	b	.L20
-.L18:
-	ldr	r3, [fp, #-16]
-	ldr	r2, [r3, #4]
-	ldr	r3, [fp, #-20]
-	str	r3, [r2, #40]
-	ldr	r2, [fp, #-16]
-	ldr	r3, [fp, #-20]
-	str	r3, [r2, #4]
-.L20:
-	ldr	r3, [fp, #-16]
-	ldr	r3, [r3, #8]
-	add	r2, r3, #1
-	ldr	r3, [fp, #-16]
-	str	r2, [r3, #8]
-	mov	r3, #0
-	str	r3, [fp, #-24]
-	b	.L21
-.L16:
-	mvn	r3, #0
-	str	r3, [fp, #-24]
-.L21:
-	ldr	r3, [fp, #-24]
-	mov	r0, r3
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-	.size	PushToTDPQ, .-PushToTDPQ
-	.align	2
-	.global	TDPQGetStart
-	.type	TDPQGetStart, %function
-TDPQGetStart:
-	@ args = 0, pretend = 0, frame = 8
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #8
-	str	r0, [fp, #-16]
-	ldr	r0, [fp, #-16]
-	bl	TDPQReady(PLT)
-	mov	r3, r0
-	cmp	r3, #0
-	bne	.L24
-	ldr	r3, [fp, #-16]
-	ldr	r3, [r3, #8]
-	cmp	r3, #0
-	ble	.L26
-.L24:
-	ldr	r3, [fp, #-16]
-	ldr	r3, [r3, #0]
-	str	r3, [fp, #-20]
-	b	.L27
-.L26:
-	mvn	r3, #0
-	str	r3, [fp, #-20]
-.L27:
-	ldr	r3, [fp, #-20]
-	mov	r0, r3
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-	.size	TDPQGetStart, .-TDPQGetStart
-	.align	2
-	.global	TDPQPopStart
-	.type	TDPQPopStart, %function
-TDPQPopStart:
-	@ args = 0, pretend = 0, frame = 8
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #8
-	str	r0, [fp, #-16]
-	ldr	r0, [fp, #-16]
-	bl	TDPQReady(PLT)
-	mov	r3, r0
-	cmp	r3, #0
-	bne	.L30
-	ldr	r3, [fp, #-16]
-	ldr	r3, [r3, #8]
-	cmp	r3, #0
-	bne	.L32
-.L30:
-	ldr	r3, [fp, #-16]
-	ldr	r3, [r3, #0]
-	ldr	r2, [r3, #40]
-	ldr	r3, [fp, #-16]
-	str	r2, [r3, #0]
-	ldr	r3, [fp, #-16]
-	ldr	r3, [r3, #8]
-	sub	r2, r3, #1
-	ldr	r3, [fp, #-16]
-	str	r2, [r3, #8]
-	b	.L29
-.L32:
-	mvn	r3, #0
-	str	r3, [fp, #-20]
-.L29:
-	ldr	r0, [fp, #-20]
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-	.size	TDPQPopStart, .-TDPQPopStart
-	.ident	"GCC: (GNU) 4.0.2"
diff --git a/lib/rps.c b/lib/rps.c
index 20707b46fddf4f35699e20512525b72e610b6a2f..6ac8bbfc45374562487473a401776f572760e0d9 100644
--- a/lib/rps.c
+++ b/lib/rps.c
@@ -1,2 +1,53 @@
 #include <rps.h>
 
+int RPSServer(){
+  char Name[8];
+  Name[0]='R';
+  Name[1]='P';
+  Name[2]='S';
+  Name[3]='S';
+  Name[4]='e';
+  Name[5]='r';
+  Name[6]='v';
+  Name[7]=0;
+
+  int Result = RegisterAs(&Name);
+
+  if(Result = SUCCESS){
+    // host the game, waiting to receive
+  }else return Result;
+}
+
+int RPSClient1(){
+  char Name[7];
+  Name[0]='R';
+  Name[1]='P';
+  Name[2]='S';
+  Name[3]='C';
+  Name[4]='L';
+  Name[5]='1';
+  Name[6]=0;
+
+  int Result = RegisterAs(&Name);
+  
+  if(Result = SUCCESS){
+    // send some message
+  }else return Result;
+}
+
+int RPSClient2(){
+  char Name[7];
+  Name[0]='R';
+  Name[1]='P';
+  Name[2]='S';
+  Name[3]='C';
+  Name[4]='L';
+  Name[5]='2';
+  Name[6]=0;
+
+  int Result = RegisterAs(&Name);
+  
+  if(Result = SUCCESS){
+    // send some message
+  }else return Result;
+}
diff --git a/lib/scheduler.o b/lib/scheduler.o
deleted file mode 100644
index 4d5ca2ada3c4ea4c92139fe1343eb5156e4e6074..0000000000000000000000000000000000000000
Binary files a/lib/scheduler.o and /dev/null differ
diff --git a/lib/scheduler.s b/lib/scheduler.s
deleted file mode 100644
index 4cca14df4581d395cc980e80b3064752d75ec3c5..0000000000000000000000000000000000000000
--- a/lib/scheduler.s
+++ /dev/null
@@ -1,92 +0,0 @@
-	.file	"scheduler.c"
-	.text
-	.align	2
-	.global	pushToScheduler
-	.type	pushToScheduler, %function
-pushToScheduler:
-	@ args = 0, pretend = 0, frame = 12
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #12
-	str	r0, [fp, #-20]
-	str	r1, [fp, #-24]
-	ldr	r3, [fp, #-20]
-	add	r1, r3, #4
-	ldr	r3, [fp, #-24]
-	ldr	r2, [r3, #32]
-	mov	r3, r2
-	mov	r3, r3, asl #1
-	add	r3, r3, r2
-	mov	r3, r3, asl #2
-	add	r3, r1, r3
-	mov	r0, r3
-	ldr	r1, [fp, #-24]
-	bl	PushToTDPQ(PLT)
-	mov	r3, r0
-	str	r3, [fp, #-16]
-	ldr	r3, [fp, #-16]
-	mov	r0, r3
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-	.size	pushToScheduler, .-pushToScheduler
-	.align	2
-	.global	getNextTaskScheduler
-	.type	getNextTaskScheduler, %function
-getNextTaskScheduler:
-	@ args = 0, pretend = 0, frame = 20
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #20
-	str	r0, [fp, #-28]
-	mov	r3, #0
-	str	r3, [fp, #-20]
-	b	.L4
-.L5:
-	ldr	r3, [fp, #-28]
-	add	r1, r3, #4
-	ldr	r2, [fp, #-20]
-	mov	r3, r2
-	mov	r3, r3, asl #1
-	add	r3, r3, r2
-	mov	r3, r3, asl #2
-	add	r3, r1, r3
-	str	r3, [fp, #-16]
-	ldr	r0, [fp, #-16]
-	bl	TDPQReady(PLT)
-	mov	r3, r0
-	cmp	r3, #0
-	beq	.L6
-	ldr	r3, [fp, #-16]
-	ldr	r3, [r3, #8]
-	cmp	r3, #0
-	ble	.L6
-	ldr	r0, [fp, #-16]
-	bl	TDPQGetStart(PLT)
-	mov	r3, r0
-	str	r3, [fp, #-24]
-	ldr	r0, [fp, #-16]
-	bl	TDPQPopStart(PLT)
-	ldr	r3, [fp, #-24]
-	str	r3, [fp, #-32]
-	b	.L9
-.L6:
-	ldr	r3, [fp, #-20]
-	add	r3, r3, #1
-	str	r3, [fp, #-20]
-.L4:
-	ldr	r3, [fp, #-20]
-	cmp	r3, #7
-	ble	.L5
-	mov	r3, #0
-	str	r3, [fp, #-32]
-.L9:
-	ldr	r3, [fp, #-32]
-	mov	r0, r3
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-	.size	getNextTaskScheduler, .-getNextTaskScheduler
-	.ident	"GCC: (GNU) 4.0.2"
diff --git a/lib/syscall-handler.c b/lib/syscall-handler.c
index 15ab28b3d59b3635662da62ea70a640c3dc26cf8..4c95eab75ba32f595addbd81eaa78ddc855516f1 100644
--- a/lib/syscall-handler.c
+++ b/lib/syscall-handler.c
@@ -26,9 +26,14 @@ void handlerCreate(KernelStruct* Colonel) {
 	Colonel->Active->RetVal = NewTask->TaskID;
 }
 
+<<<<<<< HEAD
+void handlerSend(TD* Task, int TaskID, char* Msg, int MsgLen, char* Reply, int ReplyLen) {
+	int result;
+=======
 
 int handlerSend(KernelStruct* Colonel) {
 	int Result;
+>>>>>>> f845a6b4431f235529ed4297cf336ccd623a7a5f
 	AP* Args = Colonel->Active->Args;
 
 	int A0 = (int)Args->arg0; 
@@ -75,8 +80,66 @@ int handlerReply(int TaskID, void* Reply, int ReplyLen) {
 
 }
 
+
+
+void handlerRecordNS(KernelStruct* Colonel){
+  AP* Args = Colonel->Active->Args;
+  int NSTid = (int)Ars->arg0;
+  Colonel->NameServerID = NSTid;
+}
+
+void handlerWhoIS(KernelStruct* Colnel){
+  AP* Args = Colonel->Active->Args;
+  // to be finished, send kernel part function
+}
+
 void Handle(KernelStruct* Colonel, int n) {
 //	bwprintf(COM2,"Handle: n=%d\n\r",n);
+<<<<<<< HEAD
+  
+  switch(n) {
+  case SYS_Create:
+    //bwprintf(COM2,"before, Args = %d\n\r",Args);
+    handlerCreate(Colonel); 
+    break;
+  case SYS_MyTid:
+    (Colonel->Active)->RetVal = (Colonel->Active)->TaskID;
+    pushToScheduler(Colonel,Colonel->Active);
+    Colonel->Active = NULL;
+    break;
+  case SYS_ParentTid:
+    (Colonel->Active)->RetVal = (Colonel->Active)->ParentID;
+    pushToScheduler(Colonel,Colonel->Active);
+    Colonel->Active = NULL;
+    break;
+  case SYS_Pass:
+    pushToScheduler(Colonel,Colonel->Active);
+    Colonel->Active = NULL;
+    break;
+  case SYS_Exit:
+    (Colonel->Active)->TaskState = Zombie;
+    Colonel->Active = NULL;
+    break;
+  case SYS_Send:
+    break;
+    
+  case SYS_Receive:
+    break;
+    
+  case SYS_Reply:
+    break;
+
+  case SYS_RecordNS:
+    handlerRecordNS(Colonel);
+    break;
+  case SYS_WHOIS:
+    handlerWhoIS(Colonel);
+    break;
+  case SYS_REGAS:
+    handlerRegAs(Colonel);
+    break;
+  }
+=======
 	switch(n) {
 		case SYS_Create:
 			//bwprintf(COM2,"before, Args = %d\n\r",Args);
@@ -112,6 +175,7 @@ void Handle(KernelStruct* Colonel, int n) {
 			(Colonel->Active)->RetVal = handlerReply(Colonel);
 			break;
 	}
+>>>>>>> f845a6b4431f235529ed4297cf336ccd623a7a5f
 }
 
 void fakeExit(TD* Task){
diff --git a/lib/syscall-handler.o b/lib/syscall-handler.o
deleted file mode 100644
index df9a8c73cd9036a03d6dd1edf5273400aa4b3ef7..0000000000000000000000000000000000000000
Binary files a/lib/syscall-handler.o and /dev/null differ
diff --git a/lib/syscall-handler.s b/lib/syscall-handler.s
deleted file mode 100644
index 6b4af31aabea5e4e960c0db0a58a584beb184dd8..0000000000000000000000000000000000000000
--- a/lib/syscall-handler.s
+++ /dev/null
@@ -1,203 +0,0 @@
-	.file	"syscall-handler.c"
-	.text
-	.align	2
-	.global	handlerCreate
-	.type	handlerCreate, %function
-handlerCreate:
-	@ args = 0, pretend = 0, frame = 32
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #32
-	str	r0, [fp, #-44]
-	ldr	r3, [fp, #-44]
-	ldr	r3, [r3, #0]
-	ldr	r3, [r3, #16]
-	str	r3, [fp, #-40]
-	ldr	r3, [fp, #-40]
-	ldr	r3, [r3, #0]
-	str	r3, [fp, #-36]
-	ldr	r3, [fp, #-40]
-	ldr	r3, [r3, #4]
-	str	r3, [fp, #-32]
-	ldr	r3, [fp, #-40]
-	ldr	r3, [r3, #8]
-	str	r3, [fp, #-28]
-	ldr	r3, [fp, #-40]
-	ldr	r3, [r3, #12]
-	str	r3, [fp, #-24]
-	ldr	r3, [fp, #-36]
-	str	r3, [fp, #-20]
-	ldr	r3, [fp, #-32]
-	ldr	r0, [fp, #-44]
-	ldr	r1, [fp, #-20]
-	mov	r2, r3
-	bl	CreateTask(PLT)
-	mov	r3, r0
-	str	r3, [fp, #-16]
-	ldr	r0, [fp, #-44]
-	ldr	r1, [fp, #-16]
-	bl	pushToScheduler(PLT)
-	ldr	r3, [fp, #-44]
-	ldr	r2, [r3, #0]
-	ldr	r3, [fp, #-16]
-	ldr	r3, [r3, #20]
-	str	r3, [r2, #12]
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-	.size	handlerCreate, .-handlerCreate
-	.align	2
-	.global	Handle
-	.type	Handle, %function
-Handle:
-	@ args = 0, pretend = 0, frame = 8
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #8
-	str	r0, [fp, #-16]
-	str	r1, [fp, #-20]
-	ldr	r3, [fp, #-20]
-	cmp	r3, #4
-	addls	pc, pc, r3, asl #2
-	b	.L11
-	.p2align 2
-.L10:
-	b	.L5
-	b	.L6
-	b	.L7
-	b	.L8
-	b	.L9
-.L5:
-	ldr	r0, [fp, #-16]
-	bl	handlerCreate(PLT)
-	b	.L11
-.L6:
-	ldr	r3, [fp, #-16]
-	ldr	r2, [r3, #0]
-	ldr	r3, [fp, #-16]
-	ldr	r3, [r3, #0]
-	ldr	r3, [r3, #20]
-	str	r3, [r2, #12]
-	ldr	r3, [fp, #-16]
-	ldr	r3, [r3, #0]
-	ldr	r0, [fp, #-16]
-	mov	r1, r3
-	bl	pushToScheduler(PLT)
-	ldr	r2, [fp, #-16]
-	mov	r3, #0
-	str	r3, [r2, #0]
-	b	.L11
-.L7:
-	ldr	r3, [fp, #-16]
-	ldr	r2, [r3, #0]
-	ldr	r3, [fp, #-16]
-	ldr	r3, [r3, #0]
-	ldr	r3, [r3, #24]
-	str	r3, [r2, #12]
-	ldr	r3, [fp, #-16]
-	ldr	r3, [r3, #0]
-	ldr	r0, [fp, #-16]
-	mov	r1, r3
-	bl	pushToScheduler(PLT)
-	ldr	r2, [fp, #-16]
-	mov	r3, #0
-	str	r3, [r2, #0]
-	b	.L11
-.L8:
-	ldr	r3, [fp, #-16]
-	ldr	r3, [r3, #0]
-	ldr	r0, [fp, #-16]
-	mov	r1, r3
-	bl	pushToScheduler(PLT)
-	ldr	r2, [fp, #-16]
-	mov	r3, #0
-	str	r3, [r2, #0]
-	b	.L11
-.L9:
-	ldr	r3, [fp, #-16]
-	ldr	r2, [r3, #0]
-	mov	r3, #4
-	str	r3, [r2, #28]
-	ldr	r2, [fp, #-16]
-	mov	r3, #0
-	str	r3, [r2, #0]
-.L11:
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-	.size	Handle, .-Handle
-	.section	.rodata
-	.align	2
-.LC0:
-	.ascii	"Fake Exit:r1 %d, lr %d, r2 %d, r0 %d\012\015\000"
-	.text
-	.align	2
-	.global	fakeExit
-	.type	fakeExit, %function
-fakeExit:
-	@ args = 0, pretend = 0, frame = 20
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {sl, fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #28
-	ldr	sl, .L15
-.L14:
-	add	sl, pc, sl
-	str	r0, [fp, #-36]
-	ldmfd r0, {r0-r3}
-	
-	str	r0, [fp, #-32]
-	str	r1, [fp, #-28]
-	str	r2, [fp, #-24]
-	str	r3, [fp, #-20]
-	ldr	r3, [fp, #-24]
-	str	r3, [sp, #0]
-	ldr	r3, [fp, #-20]
-	str	r3, [sp, #4]
-	mov	r0, #1
-	ldr	r3, .L15+4
-	add	r3, sl, r3
-	mov	r1, r3
-	ldr	r2, [fp, #-32]
-	ldr	r3, [fp, #-28]
-	bl	bwprintf(PLT)
-	sub	sp, fp, #16
-	ldmfd	sp, {sl, fp, sp, pc}
-.L16:
-	.align	2
-.L15:
-	.word	_GLOBAL_OFFSET_TABLE_-(.L14+8)
-	.word	.LC0(GOTOFF)
-	.size	fakeExit, .-fakeExit
-	.align	2
-	.global	Activate
-	.type	Activate, %function
-Activate:
-	@ args = 0, pretend = 0, frame = 12
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #12
-	str	r0, [fp, #-20]
-	str	r1, [fp, #-24]
-	ldr	r3, [fp, #-20]
-	ldr	r3, [r3, #0]
-	cmp	r3, #0
-	bne	.L18
-	ldr	r2, [fp, #-20]
-	ldr	r3, [fp, #-24]
-	str	r3, [r2, #0]
-.L18:
-	ldr	r0, [fp, #-24]
-	bl	kerxit(PLT)
-	str	r0, [fp, #-16]
-	ldr	r3, [fp, #-16]
-	mov	r0, r3
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-	.size	Activate, .-Activate
-	.ident	"GCC: (GNU) 4.0.2"
diff --git a/lib/syscall.c b/lib/syscall.c
index f91fbdb248e6e0ca2b5832786dc33dcd43ccd6c4..2e131a25f0f7ebc1aeb3f9ed708f32fe3d2872b4 100644
--- a/lib/syscall.c
+++ b/lib/syscall.c
@@ -2,6 +2,14 @@
 #include <context-switch.h>
 #include <bwio.h>
 
+int RecordNameServer(AP* Args){
+  asm volatile("swi 8\n\t");
+  register int RetVal asm("r0");
+  int Return = RetVal;
+  return Return;
+}
+
+
 int Create (AP* Args) {
   //bwprintf(COM2,"Create: Arg location:%d\n\r",Args);
   asm volatile ("swi 0\n\t" );
@@ -37,18 +45,46 @@ void Exit() {
   asm volatile ("swi 4\n\t");
 }
 
+int ActualSend(AP* Args){
+   asm volatile ("swi 5\n\t");
+   register int RetVal asm("r0");
+   int R = RetVal;
+   return R;
+}
+
 // tid is that of the one its sending to
 int Send (int TaskID, void* Msg, int MsgLen, void* Reply, int ReplyLen) {
-  asm volatile ("swi 5\n\t");
+  AP Args;
+  Args.arg0 = (void *)(TaskID);
+  Args.arg1 = (void *)(Msg);
+  Args.arg2 = (void *)(MsgLen);
+  Args.arg3 = (void *)(Reply);
+  Args.arg4 = (void *)(ReplyLen);
+
+  int Return = ActualSend(&Args);
+  
+  return Return;
+}
+
+int ActualReceive(AP* Args){
+  asm volatile ("swi 6\n\t");
   register int RetVal asm("r0");
   int Return = RetVal;
   return Return;
 }
 
+int Receive (int TaskID, void* Msg, int MsgLen) {
+  AP Args;
+  Args.arg0 = (void *)(TaskID);
+  Args.arg1 = (void *)(Msg);
+  Args.arg2 = (void *)(MsgLen);
 
+  int Return = ActualReceive(&Args);
+  return Return;
+}
 
-int Receive (int TaskID, void* Msg, int MsgLen) {
-  asm volatile ("swi 6\n\t");
+int ActualReplay(AP* Args){
+  asm volatile ("swi 7\n\t");
   register int RetVal asm("r0");
   int Return = RetVal;
   return Return;
@@ -58,9 +94,11 @@ int Receive (int TaskID, void* Msg, int MsgLen) {
 The calling task and the sender return at the same logical time. If they are of the same priority the sender runs first.
 */
 int Reply (int TaskID, void* Reply, int ReplyLen) {
-  asm volatile ("swi 7\n\t");
-  register int RetVal asm("r0");
-  int Return = RetVal;
+  AP Args;
+  Args.arg0 = (void *)(TaskID);
+  Args.arg1 = (void *)(Reply);
+  Args.arg2 = (void *)(ReplyLen);
+
+  int Return = ActualReplay(&Args);
   return Return;
 }
-
diff --git a/lib/syscall.o b/lib/syscall.o
deleted file mode 100644
index 1e28d21ee7e9a8c33da21ae6638aa4bd648ef4e9..0000000000000000000000000000000000000000
Binary files a/lib/syscall.o and /dev/null differ
diff --git a/lib/syscall.s b/lib/syscall.s
deleted file mode 100644
index 18670290a982d353c02391a9a5186f3ca2cf350f..0000000000000000000000000000000000000000
--- a/lib/syscall.s
+++ /dev/null
@@ -1,92 +0,0 @@
-	.file	"syscall.c"
-	.text
-	.align	2
-	.global	Create
-	.type	Create, %function
-Create:
-	@ args = 0, pretend = 0, frame = 8
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #8
-	str	r0, [fp, #-20]
-	swi 0
-	
-	str	r0, [fp, #-16]
-	ldr	r3, [fp, #-16]
-	mov	r0, r3
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-	.size	Create, .-Create
-	.align	2
-	.global	MyTid
-	.type	MyTid, %function
-MyTid:
-	@ args = 0, pretend = 0, frame = 8
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {sl, fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #8
-	ldr	sl, .L6
-.L5:
-	add	sl, pc, sl
-	ldr	r3, .L6+4
-	ldr	r3, [sl, r3]
-	str	r3, [fp, #-24]
-	swi 1
-	
-	str	r0, [fp, #-20]
-	mov	r3, r0
-	mov	r0, r3
-	sub	sp, fp, #16
-	ldmfd	sp, {sl, fp, sp, pc}
-.L7:
-	.align	2
-.L6:
-	.word	_GLOBAL_OFFSET_TABLE_-(.L5+8)
-	.word	MyTid(GOT)
-	.size	MyTid, .-MyTid
-	.align	2
-	.global	MyParentTid
-	.type	MyParentTid, %function
-MyParentTid:
-	@ args = 0, pretend = 0, frame = 0
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	swi 2
-	
-	mov	r3, r0
-	mov	r0, r3
-	ldmfd	sp, {fp, sp, pc}
-	.size	MyParentTid, .-MyParentTid
-	.align	2
-	.global	Pass
-	.type	Pass, %function
-Pass:
-	@ args = 0, pretend = 0, frame = 0
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	swi 3
-	
-	ldmfd	sp, {fp, sp, pc}
-	.size	Pass, .-Pass
-	.align	2
-	.global	Exit
-	.type	Exit, %function
-Exit:
-	@ args = 0, pretend = 0, frame = 0
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	swi 4
-	
-	ldmfd	sp, {fp, sp, pc}
-	.size	Exit, .-Exit
-	.ident	"GCC: (GNU) 4.0.2"
diff --git a/lib/td.o b/lib/td.o
deleted file mode 100644
index ff90a7c005e132cf794e99ce75461202b34728d4..0000000000000000000000000000000000000000
Binary files a/lib/td.o and /dev/null differ
diff --git a/lib/td.s b/lib/td.s
deleted file mode 100644
index c3d4bd644640aeed617739c8e290f270e12bff7b..0000000000000000000000000000000000000000
--- a/lib/td.s
+++ /dev/null
@@ -1,182 +0,0 @@
-	.file	"td.c"
-	.text
-	.align	2
-	.global	CreateTask
-	.type	CreateTask, %function
-CreateTask:
-	@ args = 0, pretend = 0, frame = 24
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #24
-	str	r0, [fp, #-24]
-	str	r1, [fp, #-28]
-	str	r2, [fp, #-32]
-	ldr	r3, [fp, #-24]
-	ldr	r3, [r3, #2748]
-	cmp	r3, #0
-	bne	.L2
-	mov	r3, #0
-	str	r3, [fp, #-36]
-	b	.L4
-.L2:
-	ldr	r0, [fp, #-24]
-	bl	GetFreeTD(PLT)
-	mov	r3, r0
-	str	r3, [fp, #-20]
-	ldr	r2, [fp, #-20]
-	mov	r3, #1
-	str	r3, [r2, #28]
-	ldr	r2, [fp, #-20]
-	ldr	r3, [fp, #-28]
-	str	r3, [r2, #32]
-	mvn	r3, #-2147483648
-	str	r3, [fp, #-16]
-	ldr	r3, [fp, #-20]
-	ldr	r3, [r3, #20]
-	mov	r2, r3
-	ldr	r3, [fp, #-16]
-	and	r3, r2, r3
-	mov	r2, r3
-	ldr	r3, [fp, #-20]
-	str	r2, [r3, #20]
-	ldr	r3, [fp, #-24]
-	ldr	r3, [r3, #0]
-	cmp	r3, #0
-	bne	.L5
-	ldr	r2, [fp, #-20]
-	mov	r3, #0
-	str	r3, [r2, #24]
-	b	.L7
-.L5:
-	ldr	r3, [fp, #-24]
-	ldr	r3, [r3, #0]
-	ldr	r2, [r3, #20]
-	ldr	r3, [fp, #-20]
-	str	r2, [r3, #24]
-.L7:
-	ldr	r2, [fp, #-20]
-	ldr	r3, .L9
-	str	r3, [r2, #8]
-	ldr	r3, [fp, #-32]
-	add	r3, r3, #2195456
-	mov	r2, r3
-	ldr	r3, [fp, #-20]
-	str	r2, [r3, #4]
-	ldr	r3, [fp, #-24]
-	ldr	r3, [r3, #2748]
-	sub	r2, r3, #1
-	ldr	r3, [fp, #-24]
-	str	r2, [r3, #2748]
-	ldr	r3, [fp, #-20]
-	str	r3, [fp, #-36]
-.L4:
-	ldr	r3, [fp, #-36]
-	mov	r0, r3
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-.L10:
-	.align	2
-.L9:
-	.word	1610612944
-	.size	CreateTask, .-CreateTask
-	.align	2
-	.global	RemoveTask
-	.type	RemoveTask, %function
-RemoveTask:
-	@ args = 0, pretend = 0, frame = 8
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #8
-	str	r0, [fp, #-16]
-	str	r1, [fp, #-20]
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-	.size	RemoveTask, .-RemoveTask
-	.align	2
-	.global	isTaskAvailable
-	.type	isTaskAvailable, %function
-isTaskAvailable:
-	@ args = 0, pretend = 0, frame = 4
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #4
-	str	r0, [fp, #-16]
-	ldr	r3, [fp, #-16]
-	mov	r3, r3, asr #31
-	mov	r0, r3
-	ldmfd	sp, {r3, fp, sp, pc}
-	.size	isTaskAvailable, .-isTaskAvailable
-	.align	2
-	.global	GetGeneration
-	.type	GetGeneration, %function
-GetGeneration:
-	@ args = 0, pretend = 0, frame = 8
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #8
-	str	r0, [fp, #-20]
-	ldr	r3, [fp, #-20]
-	ldr	r3, [r3, #20]
-	str	r3, [fp, #-16]
-	ldr	r3, [fp, #-16]
-	mov	r3, r3, asl #1
-	mov	r3, r3, asr #17
-	mov	r0, r3
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-	.size	GetGeneration, .-GetGeneration
-	.align	2
-	.global	GetAvailability
-	.type	GetAvailability, %function
-GetAvailability:
-	@ args = 0, pretend = 0, frame = 8
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #8
-	str	r0, [fp, #-20]
-	mov	r3, #-2147483648
-	str	r3, [fp, #-16]
-	ldr	r3, [fp, #-20]
-	ldr	r2, [r3, #20]
-	ldr	r3, [fp, #-16]
-	and	r3, r2, r3
-	mov	r0, r3
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-	.size	GetAvailability, .-GetAvailability
-	.align	2
-	.global	GetMemoryIndex
-	.type	GetMemoryIndex, %function
-GetMemoryIndex:
-	@ args = 0, pretend = 0, frame = 8
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #8
-	str	r0, [fp, #-20]
-	ldr	r3, .L21
-	str	r3, [fp, #-16]
-	ldr	r3, [fp, #-20]
-	ldr	r2, [r3, #20]
-	ldr	r3, [fp, #-16]
-	and	r3, r2, r3
-	mov	r0, r3
-	sub	sp, fp, #12
-	ldmfd	sp, {fp, sp, pc}
-.L22:
-	.align	2
-.L21:
-	.word	131071
-	.size	GetMemoryIndex, .-GetMemoryIndex
-	.ident	"GCC: (GNU) 4.0.2"
diff --git a/lib/timer.c b/lib/timer.c
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..2e8b0d7ea2d6474f2129e2878611402a2ce0b7a8 100644
--- a/lib/timer.c
+++ b/lib/timer.c
@@ -0,0 +1,27 @@
+#include <types.h>
+#include <ts7200.h>
+
+void ClockInit(Clock *MyClock)
+{
+  MyClock->ClockCount = 0;
+  MyClock->LastTimerValue = CLOCK_LOAD_VALUE;
+  unsigned int* Clock3LoadRegsiter = (unsigned int *)(TIMER3_BASE + LDR_OFFSET);
+  unsigned int* Clock3ControlRegister = (unsigned int *)(TIMER3_BASE + CRTL_OFFSET);
+  // set interval
+  *Clock3LoadRegister = CLOCK_LOAD_VALUE;
+  // enable clock
+  *Clock3ControlRegister = ENABLE_MASK | ClockConfig;
+}
+
+void ClockUpdate(Clock *MyClock)
+{
+  unsigned int *ValRegister = (unsigned int *)(TIMER3_BASE+VAL_OFFSET);
+  unsigned int CurrentTimerValue = *ValRegister;
+  if(CurrentTimerValue > MyClock->LastTimerValue){
+    MyClock->ClockCount = MyClock->ClockCount + 1;
+    MyClock->bChanged = 1;
+  } else {
+    MyClock->bChanged = 0;
+  }
+  MyClock->LastTimerValue = CurrentTimerValue;
+}
diff --git a/lib/tools.c b/lib/tools.c
index 69d6315026b3fde30769febb7a5551e870b763ad..ba8b2ed8269c59bbba9239d8ed17c100c581e4fe 100644
--- a/lib/tools.c
+++ b/lib/tools.c
@@ -1,4 +1,5 @@
 #include <tools.h>
+
 // Reference: http://clc-wiki.net/wiki/C_standard_library:string.h:strlen
 int stringLen(const char* Str) {
     int Length;
diff --git a/lib/trie.c b/lib/trie.c
new file mode 100644
index 0000000000000000000000000000000000000000..f4a227bfc733ade31d11c75b7d6ec7350604ddbf
--- /dev/null
+++ b/lib/trie.c
@@ -0,0 +1,89 @@
+#include <trie.h>
+
+int GetBranchIndex(char a){
+  if((a<='Z' && a>='A')) return a-'A';
+  if((a<='z' && a>='a')) return ((a-'a')+26);
+  return -1;
+}
+
+
+int InsertTo(Trie* Trie, TrieLayer* NewLayer,char *Str,int Len){
+  char c;
+  int i = 0;
+  int SubstrIndex = 0;
+  int index;
+  TrieLayer *Up = Trie->FirstLayer;
+  TrieLayer *Down;
+  for(;i<Len;){
+    index = GetBranchIndex(Str[i]);
+    Down = (Up->Branch)[index];
+    if(Down == NULL){
+      (Up->Branch)[index] = NewLayer;
+      SubstrIndex = 0;
+      for(i = Up->Depth;i<(Len-1);i++,SubstrIndex++){
+	NewLayer->String[SubstrIndex] = Str[i+1];
+      }
+      NewLayer->String[SubstrIndex] = 0;
+      break;
+    }
+    if(i == (Len -1)){
+      Down->TID = (NewLayer->Branch[Str[Len-1]])->TID;
+    }
+    c = Down->String[SubstrIndex];
+    for(SubstrIndex = 0; c != 0; SubstrIndex++){
+      if(Str[i+SubstrIndex+1]!=c){
+	(Up->Branch)[index] = NewLayer;
+	(NewLayer->Branch)[c] = Down;
+	NewLayer->Depth = i+SubstrIndex+1;
+	// copy preffix of Down to NewLayer
+	for(i=0;i<SubstrIndex;i++){
+	  (NewLayer->String)[i] = (Down->String)[i];
+	}
+	(NewLayer->String)[i] = 0;
+	c = (Down->String)[i];
+	// copy suffix of Down to start of Down
+	for(i = SubstrIndex+1;c!=0;i++){
+	  (Down->String)[i-SubstrIndex-1] = c;
+	  c = (Down->String)[i+1];
+	}
+	return 0;
+      }
+    }
+    i = Down->Depth;
+    Up = Down;
+  }
+  return 0;
+}
+	
+    
+
+int TrieLookup(Trie* Trie, char *Str, int Len){
+  if(Trie->Depth < Len) return -1;
+  if(Len > NAME_LENGTH_MAX) return -1;
+  char c;
+  int i = 0;
+  int SubstrIndex = 0;
+  int index;
+  TrieLayer *T = Trie->FirstLayer;
+  for(;i<Len;){
+    index = GetBranchIndex(Str[i]);
+    T = (T->Branch)[index];
+    // if No next layer and i did not reach the end of str, return -1
+    if(T == NULL) return -1;
+    if(i == (Len-1)) return T->TID;
+    if(T->Depth >= Len) return -1;
+    // check if the substring all match
+    c = T->String[SubstrIndex];
+    for(SubstrIndex = 0; c != 0; SubstrIndex++){
+      // if any of the substring does not match, break
+      if(Str[i + SubstrIndex + 1] != c) return -1;
+      c = T->String[SubstrIndex];
+    }
+    // if match ,proceed to next layer
+    i = T->Depth;
+  }
+  return -1;
+}
+  
+// TODO, if index is -1, break and return illegal name
+    
diff --git a/src/developing/hahah.c b/src/developing/hahah.c
new file mode 100644
index 0000000000000000000000000000000000000000..68fea9314b09da50015e08795e9b972dd558cb06
--- /dev/null
+++ b/src/developing/hahah.c
@@ -0,0 +1,63 @@
+#include <types.h>
+#include <bwio.h>
+/*
+void test(TD* T){
+  asm volatile(//"mov r0, #0\n\t"
+	       "mov r1, #11\n\t"
+	       "mov r2, #22\n\t"
+	       "mov r3, #33\n\t"
+	       "mov r4, #44\n\t"
+	       "mov r5, #55\n\t"
+	       "add r0, r0,#20\n\t"
+	       "stmfd r0!, {r1-r5}\n\t"
+	       //"ldmfd sp!, {r4}\n\t"
+	       );
+
+
+  asm volatile("ldmfd r0!,{r4}\n\t"
+	       "ldmfd r0!,{r5-r8}\n\t");
+  //register int r0 asm("r0");
+  //int zero = r0;
+  register int r4 asm("r4");
+  int four = r4;
+  int *t=(int *)T;
+  //bwprintf(COM2,"r0:%d, t1:%d\n\r",T->sp,t[0]);
+  register int r5 asm("r5");
+  int five = r5;
+  register int r6 asm("r6");
+  int six = r6;
+  register int r7 asm("r7");
+  int seven = r7;
+  register int r8 asm("r8");
+  int eight = r8;
+  
+  bwprintf(COM2,"sp:%d, lr:%d, spsr:%d, retval:%d, args:%d\n\r",T->sp,T->lr,T->spsr,T->RetVal,T->Args);
+  bwprintf(COM2,"r4:%d, r5:%d, r6:%d, r7:%d, r8:%d\n\r",four,five,six,seven,eight);
+}
+*/
+int main(){
+/*
+  //TD T;
+  //T.sp = 0x1e000000;
+  //T.lr = 222;
+  //T.spsr = 333;
+  //T.RetVal = 444;
+  //T.Args = 555;
+  //register int r4 asm("r4");
+	       
+  // bwprintf(COM2,"T:%d\n\r",r4);
+  asm volatile("mov r0, #10\n\t"
+	       "mov r1, #11\n\t"
+	       "mov r2, #22\n\t"
+	       "mov r3, #33\n\t"
+	       "mov r4, #44\n\t"
+	       "mov r5, #55\n\t"
+	       "stmfd sp!, {r0-r5}\n\t"
+	       "ldmfd sp!, {r3}\n\t");
+  //test(&T);
+  register int r3 asm("r3");
+  int three = r3;
+  bwprintf(COM2,"r3: %d\n\r",three);
+*/  
+return 0;
+}
diff --git a/src/developing/main.c b/src/developing/main.c
index 68fea9314b09da50015e08795e9b972dd558cb06..2783d93440c43560a87475e6ae0a3c84d59c353b 100644
--- a/src/developing/main.c
+++ b/src/developing/main.c
@@ -1,63 +1,8 @@
 #include <types.h>
+#include <trie.h>
 #include <bwio.h>
-/*
-void test(TD* T){
-  asm volatile(//"mov r0, #0\n\t"
-	       "mov r1, #11\n\t"
-	       "mov r2, #22\n\t"
-	       "mov r3, #33\n\t"
-	       "mov r4, #44\n\t"
-	       "mov r5, #55\n\t"
-	       "add r0, r0,#20\n\t"
-	       "stmfd r0!, {r1-r5}\n\t"
-	       //"ldmfd sp!, {r4}\n\t"
-	       );
 
-
-  asm volatile("ldmfd r0!,{r4}\n\t"
-	       "ldmfd r0!,{r5-r8}\n\t");
-  //register int r0 asm("r0");
-  //int zero = r0;
-  register int r4 asm("r4");
-  int four = r4;
-  int *t=(int *)T;
-  //bwprintf(COM2,"r0:%d, t1:%d\n\r",T->sp,t[0]);
-  register int r5 asm("r5");
-  int five = r5;
-  register int r6 asm("r6");
-  int six = r6;
-  register int r7 asm("r7");
-  int seven = r7;
-  register int r8 asm("r8");
-  int eight = r8;
-  
-  bwprintf(COM2,"sp:%d, lr:%d, spsr:%d, retval:%d, args:%d\n\r",T->sp,T->lr,T->spsr,T->RetVal,T->Args);
-  bwprintf(COM2,"r4:%d, r5:%d, r6:%d, r7:%d, r8:%d\n\r",four,five,six,seven,eight);
-}
-*/
 int main(){
-/*
-  //TD T;
-  //T.sp = 0x1e000000;
-  //T.lr = 222;
-  //T.spsr = 333;
-  //T.RetVal = 444;
-  //T.Args = 555;
-  //register int r4 asm("r4");
-	       
-  // bwprintf(COM2,"T:%d\n\r",r4);
-  asm volatile("mov r0, #10\n\t"
-	       "mov r1, #11\n\t"
-	       "mov r2, #22\n\t"
-	       "mov r3, #33\n\t"
-	       "mov r4, #44\n\t"
-	       "mov r5, #55\n\t"
-	       "stmfd sp!, {r0-r5}\n\t"
-	       "ldmfd sp!, {r3}\n\t");
-  //test(&T);
-  register int r3 asm("r3");
-  int three = r3;
-  bwprintf(COM2,"r3: %d\n\r",three);
-*/  
-return 0;
-}
+  Trie T;
+  TrieLayer First;
+  
diff --git a/src/developing/main.o b/src/developing/main.o
deleted file mode 100644
index 36edf06a140130581d35d11051df71b807955346..0000000000000000000000000000000000000000
Binary files a/src/developing/main.o and /dev/null differ
diff --git a/src/developing/main.s b/src/developing/main.s
deleted file mode 100644
index 8743442f4300d63816235e220a2b59110081a0e6..0000000000000000000000000000000000000000
--- a/src/developing/main.s
+++ /dev/null
@@ -1,20 +0,0 @@
-	.file	"main.c"
-	.text
-	.align	2
-	.global	main
-	.type	main, %function
-main:
-	@ args = 0, pretend = 0, frame = 0
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
-	sub	fp, ip, #4
-	mov	r3, #0
-	mov	r0, r3
-	
-	mov r0, #1
-	mov r1, #5
-	bl bwputr(PLT)
-	ldmfd	sp, {fp, sp, pc}
-	.size	main, .-main
-	.ident	"GCC: (GNU) 4.0.2"
diff --git a/src/main.c b/src/main.c
index 93caf47e6b04e77be4054e2afb53de58f8bba9dc..e4b324646532c214c4cb858a2d3953e735de04ec 100644
--- a/src/main.c
+++ b/src/main.c
@@ -14,41 +14,41 @@
 
 int main()
 {
-
-	KernelStruct Colonel;
-	int i, Status, req;
-	TD* Next;
-
-	InitSwi();
-	kernelInit(&Colonel); 
+  
+  KernelStruct Colonel;
+  int i, Status, req;
+  TD* Next;
+  
+  InitSwi();
+  kernelInit(&Colonel); 
 	// First User Task
-//	bwprintf(COM2, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n\r");
-//	bwprintf(COM2, "main: before calling create first task \n\r");
-	TD* FirstUserTask= CreateTask(&Colonel, Prio4, (void *) (&firstUserTaskChildren));
-
-//	bwprintf(COM2,"main function ptr: %d\n\r",(&firstUserTaskChildren));
-	pushToScheduler(&Colonel, FirstUserTask);
-	TD* Task;
-	int ReturnValue = 0;
-	FOREVER {
-		if(Colonel.Active == NULL){
-//			bwprintf(COM2, "main: Active == NULL\n\r");
-			ReturnValue = 0;
-			Task = getNextTaskScheduler(&Colonel);
-		}
-		else{
-//			bwprintf(COM2, "main: Active not NULL\n\r");
-			Task = Colonel.Active;
-			ReturnValue = Task->RetVal;
-		}
-		if(Task == NULL) break;
-		bwprintf(COM2,"main: Active->Priority: %d\n\r", Task->TaskPriority);
-		req = Activate(&Colonel,Task);
-//		bwprintf(COM2,"main: after Activates finished req= %d\n\r",req);
-//		bwprintf(COM2,"main: before Handle\n\r");
-		Handle(&Colonel, req);
-//		bwprintf(COM2, "main: done with one loop\n\r");
-//		bwprintf(COM2,"==================================================================\n\r");
-	}
-	return 0;  
+  //	bwprintf(COM2, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n\r");
+  //	bwprintf(COM2, "main: before calling create first task \n\r");
+  TD* FirstUserTask= CreateTask(&Colonel, Prio4, (void *) (&firstUserTaskChildren));
+  
+  //	bwprintf(COM2,"main function ptr: %d\n\r",(&firstUserTaskChildren));
+  pushToScheduler(&Colonel, FirstUserTask);
+  TD* Task;
+  int ReturnValue = 0;
+  FOREVER {
+    if(Colonel.Active == NULL){
+      //			bwprintf(COM2, "main: Active == NULL\n\r");
+      ReturnValue = 0;
+      Task = getNextTaskScheduler(&Colonel);
+    }
+    else{
+      //			bwprintf(COM2, "main: Active not NULL\n\r");
+      Task = Colonel.Active;
+      ReturnValue = Task->RetVal;
+    }
+    if(Task == NULL) break;
+    bwprintf(COM2,"main: Active->Priority: %d\n\r", Task->TaskPriority);
+    req = Activate(&Colonel,Task);
+    //		bwprintf(COM2,"main: after Activates finished req= %d\n\r",req);
+    //		bwprintf(COM2,"main: before Handle\n\r");
+    Handle(&Colonel, req);
+    //		bwprintf(COM2, "main: done with one loop\n\r");
+    //		bwprintf(COM2,"==================================================================\n\r");
+  }
+  return 0;  
 }
diff --git a/src/main.elf b/src/main.elf
deleted file mode 100755
index a05424ee0b37637a3b08e7773911504458f7927d..0000000000000000000000000000000000000000
Binary files a/src/main.elf and /dev/null differ
diff --git a/src/main.o b/src/main.o
deleted file mode 100644
index b1d698ffb67943d59d446e587535ebe4179162bf..0000000000000000000000000000000000000000
Binary files a/src/main.o and /dev/null differ
diff --git a/src/main.s b/src/main.s
deleted file mode 100644
index fda61f51c9188b5fd81ccb074275247bb0ce1a8a..0000000000000000000000000000000000000000
--- a/src/main.s
+++ /dev/null
@@ -1,98 +0,0 @@
-	.file	"main.c"
-	.section	.rodata
-	.align	2
-.LC0:
-	.ascii	"main: Active->Priority: %d\012\015\000"
-	.text
-	.align	2
-	.global	main
-	.type	main, %function
-main:
-	@ args = 0, pretend = 0, frame = 2780
-	@ frame_needed = 1, uses_anonymous_args = 0
-	mov	ip, sp
-	stmfd	sp!, {sl, fp, ip, lr, pc}
-	sub	fp, ip, #4
-	sub	sp, sp, #2768
-	sub	sp, sp, #12
-	ldr	sl, .L10
-.L9:
-	add	sl, pc, sl
-	bl	InitSwi(PLT)
-	sub	r3, fp, #2784
-	sub	r3, r3, #12
-	mov	r0, r3
-	bl	kernelInit(PLT)
-	sub	r3, fp, #2784
-	sub	r3, r3, #12
-	mov	r0, r3
-	mov	r1, #4
-	ldr	r3, .L10+4
-	ldr	r3, [sl, r3]
-	mov	r2, r3
-	bl	CreateTask(PLT)
-	mov	r3, r0
-	str	r3, [fp, #-28]
-	sub	r3, fp, #2784
-	sub	r3, r3, #12
-	mov	r0, r3
-	ldr	r1, [fp, #-28]
-	bl	pushToScheduler(PLT)
-	mov	r3, #0
-	str	r3, [fp, #-20]
-.L2:
-	ldr	r3, [fp, #-2796]
-	cmp	r3, #0
-	bne	.L3
-	mov	r3, #0
-	str	r3, [fp, #-20]
-	sub	r3, fp, #2784
-	sub	r3, r3, #12
-	mov	r0, r3
-	bl	getNextTaskScheduler(PLT)
-	mov	r3, r0
-	str	r3, [fp, #-24]
-	b	.L5
-.L3:
-	ldr	r3, [fp, #-2796]
-	str	r3, [fp, #-24]
-	ldr	r3, [fp, #-24]
-	ldr	r3, [r3, #12]
-	str	r3, [fp, #-20]
-.L5:
-	ldr	r3, [fp, #-24]
-	cmp	r3, #0
-	beq	.L6
-	ldr	r3, [fp, #-24]
-	ldr	r2, [r3, #32]
-	mov	r0, #1
-	ldr	r3, .L10+8
-	add	r3, sl, r3
-	mov	r1, r3
-	bl	bwprintf(PLT)
-	sub	r3, fp, #2784
-	sub	r3, r3, #12
-	mov	r0, r3
-	ldr	r1, [fp, #-24]
-	bl	Activate(PLT)
-	mov	r3, r0
-	str	r3, [fp, #-36]
-	sub	r3, fp, #2784
-	sub	r3, r3, #12
-	mov	r0, r3
-	ldr	r1, [fp, #-36]
-	bl	Handle(PLT)
-	b	.L2
-.L6:
-	mov	r3, #0
-	mov	r0, r3
-	sub	sp, fp, #16
-	ldmfd	sp, {sl, fp, sp, pc}
-.L11:
-	.align	2
-.L10:
-	.word	_GLOBAL_OFFSET_TABLE_-(.L9+8)
-	.word	firstUserTaskChildren(GOT)
-	.word	.LC0(GOTOFF)
-	.size	main, .-main
-	.ident	"GCC: (GNU) 4.0.2"
diff --git a/src/test/#mainc# b/src/test/#mainc#
new file mode 100644
index 0000000000000000000000000000000000000000..3354adff305d511fa58ef59c8e1ce29b6fd30efe
--- /dev/null
+++ b/src/test/#mainc#
@@ -0,0 +1 @@
+0;136;0c
\ No newline at end of file
diff --git a/src/test/main.c b/src/test/main.c
new file mode 100644
index 0000000000000000000000000000000000000000..586949a1134d880e349117e1054afab189a3aa3d
--- /dev/null
+++ b/src/test/main.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int main(){
+  char a = '\000';
+  printf("this is 000: %d\n",a);
+  return 0;
+}
diff --git a/src/test/test b/src/test/test
new file mode 100755
index 0000000000000000000000000000000000000000..dc7875b8abd3249a3f90dabe138fec37fe387f4c
Binary files /dev/null and b/src/test/test differ