Added the basic pagination functionality