slideshow logic centralized and cleaned up