setting up the slideshow logic