implemented slideshow function