implementing pagination and infinite scroll