Merged two functions in paging.c