Implementing pagination and infinite slideshow