Made slideshow into a self-contained function