updated index function to include pagination