Refactoring slideshow element