 	u32 leastEntry = DNE;
 	u32 leastTime  = DNE;
 	for (u32 i = 0; i < PAGE_ENTRIES; i++) {
+		/*
+		u32 tmp = CURRENTTIME - getLastUsedTime(pageTable[i]);
+		if (tmp > leastTime) {
+			leastTime = tmp;
+			leastTime = i;
+		}
+		*/
 		if (leastTime > getLastUsedTime(pageTable[i])) {
 			leastTime = getLastUsedTime(pageTable[i]);
 			leastEntry = i;

		storage[i] = memory[memoryAddress];
		memory[memoryAddress] = storage[storageAddress];
	}
	pageTable[leastEntry] = makePTE(CURRENTTIME, pageOffset, VALID);
	CURRENTTIME++;
	return leastEntry * PAGE_SIZE + pageOffset;
}


// ******************************************************************
// Read/Write
__device__ u32 isValid(u32 PTE) {
	return PTE & VALID;
}
__device__ u32 getPageNumber(u32 PTE) {
	return (PTE & PAGENUMBERMASK) >> 1;
}
__device__ u32 getLastUsedTime(u32 PTE) {
	return (PTE & LASTTIMEMASK) >> 14;
}
__device__ u32 makePTE(u32 time, u32 pageNumber, u32 validbit) {
	return (time << 14) | (pageNumber << 1) | validbit;
}
__device__ u32 paging(uchar *memory, u32 pageNumber, u32 pageOffset) {
	// ******************************************************************** //
