Add the paging and fixed bugs