Finshing static paging and some refactoring